I have two related numpy arrays, X and y . I need to select n random strings from X and store this in an array corresponding to the y value and add an index of selected randomness to it.
I have another index array that stores a list of indexes that I don't want to try.
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 were chosen randomly (where n=2 ):
randomylSelected = np.array([[0.3,0.7],[0.5,0.5]])
desired result:
index = [0,1,2,3] randomlySelectedY = [0,1]
How can i do this?
source share