I have two related numpy arrays, X and y. I need to select n random rows from X and store this in an array, the corresponding y value and the appends to it the index of the points randomly selected.
I have another array index which stores a list of index which I dont want to sample.
How can I do this?
Sample data:
index = [2,3]
X = np.array([[0.3,0.7],[0.5,0.5] ,[0.2,0.8], [0.1,0.9]])
y = np.array([[0], [1], [0], [1]])
If these X's were randomly selected (where n=2):
randomylSelected = np.array([[0.3,0.7],[0.5,0.5]])
the desired output would be:
index = [0,1,2,3]
randomlySelectedY = [0,1]
How can I do this?
randomylSelectedgiven or to be created?nrows fromX. @Divakarindexchanges from[2,3]to[0,1]when it's not sampled? What's the purpose of theindexand how does it relate to the other arrays?indexcontains a list of items already sampled which should not be sampled again.