I am a beginner in python and machine learning. while doing a project from the book "hands-on ML with sci-kit learn and TF" I came across this way of creating test-set using hashlib. Can you please help me understand what this logic of the return statement, step by step-
def test_set_check(identifier, test_ratio, hash):
return hash(np.int64(identifier)).digest()[-1]<256 * test_ratio
assuming hash
is something from hashlib
:
identifier
to a (numpy) 64bit integeridentifier
(256 * test_ratio)