'Correct syntax to "fit" a classifier in sklearn?
I am trying following simple example:
from sklearn import datasets, svm
iris = datasets.load_iris()
clf = svm.SVC(random_state=0)
For fitting, should I use following statement:
clf = clf.fit(iris.data, iris.target)
Or just:
clf.fit(iris.data, iris.target)
Both above formats have been used in different places, so I am confused.
The first method clf = clf(X,y).fit() seems to be the official version (see here).
I have tried and found that both seem to work, but I may be missing some point here.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
