``fit`` returns ``self``:
http://scikit-learn.org/dev/developers/index.html#fitting
so they are identical.
The motivation is that you can write

clf  =  svm.SVC().fit(X, y)



On 01/28/2015 03:00 PM, Pagliari, Roberto wrote:

Perhaps, this is a dumb question, but I saw both the alternatives below for using a classifier. I guess that regardless of whether you have clf = clf.fit or just clf.fit, the result does not change and you can invoke clf._attribute_ with any of the alternatives below.

Thanks,

*>>> **from**sklearn.ensemble**import*RandomForestClassifier

*>>> *X =[[0, 0], [1, 1]]

*>>> *Y =[0, 1]

*>>> *clf =RandomForestClassifier(n_estimators=10)

*>>> *clf =clf.fit(X, Y)

*>>>**from*  *sklearn*  *import*  svm
*>>>*X  =  [[0,  0],  [1,  1]]
*>>>*y  =  [0,  1]
*>>>*clf  =  svm.SVC()
*>>>*clf.fit(X, y)


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/


_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to