0

Quite new to Python and I'm trying to plot the training set of the Iris Classification dataset, however when attempting to plot I get the error "TypeError: 'tuple' object is not callable".

Here's the code:

from sklearn import datasets
iris = datasets.load_iris(return_X_y=False)

X = iris["data"][:,(2,3)] # using just two features petal len + wdth
y = iris["target"]

# Plotting 

plt.figure(figsize=(11,4)) # error here

# training examples
plt.plot(X[:, 0][y==1], X[:, 1][y==1], "bs") # iris versicolor
plt.plot(X[:, 0][y == 2], X[:, 1][y==2], "yo") # iris virginica

I've set return_X_y = False (return_X_y returns a tuple if set to True) so I'm not quite sure why I'm getting a tuple error, especially at plt.figure(figsize=(11,4))Any help would be appreciated

4

0 回答 0