Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. from keras.utils import np_utils
  2. y = np_utils.to_categorical(y, num_classes=len(labels))
  3. all_wave = np.array(all_wave).reshape(-1,8000,1)
  4. print(y.shape)
  5. print(all_wave.shape)
  6. step = all_wave.shape[0]//10
  7. print(step)
  8. for set_len in range(step, all_wave.shape[0], step):
  9. y_sliced = y[:set_len, :]
  10. all_wave_sliced = all_wave[:set_len, :, :]
  11. print(y_sliced.shape)
  12. print(all_wave_sliced.shape)
  13. from sklearn.model_selection import train_test_split
  14. x_tr, x_val, y_tr, y_val = train_test_split(np.array(all_wave_sliced),np.array(y_sliced),stratify=y_sliced,test_size = 0.2,random_state=777,shuffle=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement