It is part of the API and enforced with tests, if I'm not mistaken. So you
could use either form with all sklearn estimators.
Vlad
On December 13, 2016 3:33:48 PM EST, Stuart Reynolds
<[email protected]> wrote:
>I think he's asking whether returning the model is part of the API
>(i.e. is
>it a bug that SVM and NB don't return self?).
>
>On Tue, Dec 13, 2016 at 12:23 PM, Jacob Schreiber
><[email protected]>
>wrote:
>
>> The fit method returns the object itself, so regardless of which way
>you
>> do it, it will work. The reason the fit method returns itself is so
>that
>> you can chain methods, like "preds = clf.fit(X, y).predict(X)"
>>
>> On Tue, Dec 13, 2016 at 12:14 PM, Graham Arthur Mackenzie <
>> [email protected]> wrote:
>>
>>> Hello All,
>>>
>>> I hope this is the right way to ask a question about documentation.
>>>
>>> In the doc for Decision Trees
>>> <http://scikit-learn.org/stable/modules/tree.html#tree>, the fit
>>> statement is assigned back to the classifier:
>>>
>>> clf = clf.fit(X, Y)
>>>
>>> Whereas, for Naive Bayes
>>>
><http://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.GaussianNB.html>
>>> and Support Vector Machines
>>>
><http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html>,
>>> it's just:
>>>
>>> clf.fit(X, Y)
>>>
>>> I assumed this was a typo, but thought I should try and verify such
>>> before proceeding under that assumption. I appreciate any feedback
>you can
>>> provide.
>>>
>>> Thank You and Be Well,
>>> Graham
>>>
>>> _______________________________________________
>>> scikit-learn mailing list
>>> [email protected]
>>> https://mail.python.org/mailman/listinfo/scikit-learn
>>>
>>>
>>
>> _______________________________________________
>> scikit-learn mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/scikit-learn
>>
>>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>scikit-learn mailing list
>[email protected]
>https://mail.python.org/mailman/listinfo/scikit-learn
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
_______________________________________________
scikit-learn mailing list
[email protected]
https://mail.python.org/mailman/listinfo/scikit-learn