DOC Fix load iris datasets #19729
DOC Fix load iris datasets #19729
Conversation
…s not defined" error is thrown.
Thank you for the PR @maliozer ! I would prefer this be defined during the "Using the Iris dataset" section in line 131: >>> from sklearn.datasets import load_iris
>>> from sklearn import tree
>>> iris = load_iris()
>>> X, y = iris.data, iris.target
>>> clf = tree.DecisionTreeClassifier()
>>> clf = clf.fit(X, y) |
The reason I chose not to add it at the Using the Iris dataset section, is because it would be meaningless why the iris datasets is loaded twice until you don't apply the graphviz example. The above example demonstrates the return_X_y parameter usage. I tried to leave the example as it is. |
For this specific case, I think it is nice to show the complete usage of the >>> from sklearn.datasets import load_iris
>>> from sklearn import tree
>>> iris = load_iris()
>>> X, y = iris.data, iris.target
>>> clf = tree.DecisionTreeClassifier()
>>> clf = clf.fit(X, y) shows how to extract the Side note: Most of the user guide uses |
LGTM |
1db2681
into
scikit-learn:main
since the iris datasets is not defined above, the "name iris is not defined" error is thrown.
Reference Issues/PRs
What does this implement/fix? Explain your changes.
Any other comments?