Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. # Generate a random index for train/test split
  2. num_rows = df.shape[0]
  3. frac_test = 0.1
  4. num_test_samples = int(num_rows * frac_test)
  5.  
  6. idx = np.full(num_rows, False)
  7. idx[:num_test_samples] = True
  8. np.random.seed(8)
  9. np.random.shuffle(idx)
  10.  
  11. print(idx.shape)
  12. idx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement