Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from keras.utils import np_utils
- y = np_utils.to_categorical(y, num_classes=len(labels))
- all_wave = np.array(all_wave).reshape(-1,8000,1)
- print(y.shape)
- print(all_wave.shape)
- step = all_wave.shape[0]//10
- print(step)
- for set_len in range(step, all_wave.shape[0], step):
- y_sliced = y[:set_len, :]
- all_wave_sliced = all_wave[:set_len, :, :]
- print(y_sliced.shape)
- print(all_wave_sliced.shape)
- from sklearn.model_selection import train_test_split
- 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