Hello could someone explain how is the following code working? After importing the required libraries..
>>>features=np.random.rand(150,4) >>>features= np.append(features,np.random.randint(3,size=(150,1)),axis=1) >>>target=np.array([0,1,2]) >>>plt.scatter(features[target == 1,0], features[target == 1,1], marker='o', c='r')
I am getting a plot of 1st and 2nd column of 'features' having 1 in the last column. But I am not able to understand how.
As far as I can understand 'target==1' creates a boolean array but how can it return values of the 1st and 2nd columns when there is no value representing 1 in those columns.
Does numpy indexing search values from all columns?