To give you some recommendation targeting the task, not your problem: don't do this!
Assuming X
are your samples / observations, y
are your targets:
Just generate a random-permutation and create views (nothing copied or modified) into those, e.g. (untested):
import numpy as np
X = np.random.random(size=(50000, 3072))
y = np.random.random(size=50000)
perm = np.random.permutation(X.shape[0]) # assuming X.shape[0] == y.shape[0]
X_perm = X[perm] # views!!!
y_perm = y[perm]
Reminder: your start-shapes are not compatible to most python-based ml-tools as the usual interpretation is:
- first-dim / rows: samples
- second-dim / cols: features
As #samples need to be the same as #target-values y
, you will see that my example is correct in regards to this, while yours need a transpose on X