ValueError

Error : ValueError :‘c’ argument has 1 elements, which is not acceptable for use with ‘x’ with size 200, ‘y’ with size 200.

please find the below corrected (right) code:

def load_extra_datasets():
N = 200
gaussian_quantiles = sklearn.datasets.make_gaussian_quantiles
(mean=None, cov=0.7, n_samples=N, n_features=2, n_classes=2, shuffle=True, random_state=None)
return gaussian_quantiles

gaussian_quantiles= load_extra_datasets()
X, Y = gaussian_quantiles
X, Y = X.T, Y.reshape(1, Y.shape[0])

Visualize the data

plt.scatter(X[0, :], X[1, :], c=Y, s=40, cmap=plt.cm.Spectral);

print(X.shape)
print(Y.shape)
(2, 200)
(1, 200)

when I tried to Visualize the data get ValueError but when I did little modification in code as below :
plt.scatter(X[0, :], X[1, :], c= Y.reshape(200,) , s=40, cmap=plt.cm.Spectral);
It works.

I don’t Understand Why ??

Reference code :
https://towardsdatascience.com/neural-net-from-scratch-using-numpy-71a31f6e3675

ref: https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.scatter.html

The parameter c accepts only 2d array and Y was 1d array since you reshaped it…it worked. Go through scatterplot documentation on above link

Thank you for your guidance @iftekar-patel-f1e6bf65

In Python, a value is the information that is stored within a certain object.

To encounter a ValueError in python, means that is the problem with the content of the object you tried to assign the value to.

Passing arguments with the wrong value (e.g. a number outside expected boundaries) should result in a ValueError .

For eg,

Screenshot 2021-08-01 at 11.41.48 AM