Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Generate a random index for train/test split
- num_rows = df.shape[0]
- frac_test = 0.1
- num_test_samples = int(num_rows * frac_test)
- idx = np.full(num_rows, False)
- idx[:num_test_samples] = True
- np.random.seed(8)
- np.random.shuffle(idx)
- print(idx.shape)
- idx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement