jeudi 1 juin 2023

np.random.shuffle() is not working as expected

I want to shuffle the rows of my matrices. Here is my code:

               #prepare the training data
dat_training = data_all_training[sbj]
                
                
labels_training = dat_training.select("Label")
labels_test = dat_test.select("Label")
                

                
y_w2v_train_n = return_normal_features_for_MEG_training(labels_training, type_emb)
y_w2v_pt_n = return_normal_features_for_MEG_validation(labels_test, type_emb)
                
y_w2v_train_s = y_w2v_train_n
y_w2v_pt_s = y_w2v_pt_n

  
np.random.shuffle(y_w2v_train_s)
np.random.shuffle(y_w2v_pt_s)

print("sim", y_w2v_train_s[0,0:10] == y_w2v_train_n[0, 0:10])
print(y_w2v_train_s[0, 0:10])
print(y_w2v_train_n[0, 0:10])
print("shapes", x_train.shape, y_w2v_train.shape, x_test_pt.shape, y_w2v_pt.shape)
 

Result is:

sim [ True  True  True  True  True  True  True  True  True  True]
[ 0.12567943  0.38765216  0.05903614  0.35545474  0.15695235 -0.09684472
  0.20318605  0.09171303  0.19060805  0.19470002]
[ 0.12567943  0.38765216  0.05903614  0.35545474  0.15695235 -0.09684472
  0.20318605  0.09171303  0.19060805  0.19470002]
shapes (7200, 99) (7200, 1000) (300, 99) (300, 1000)

How can I fix it? Where is wrong?




Aucun commentaire:

Enregistrer un commentaire