Please rename subjects if you use the digest – now the thread is not complete 
in the archive. Others will have a harder time benefitting from answers.


__________________________________________________________________________________________________________________________________________
Dale T. Smith | Macy's Systems and Technology | IFS eCom CSE Data Science
5985 State Bridge Road, Johns Creek, GA 30097 | [email protected]

From: scikit-learn 
[mailto:[email protected]] On Behalf Of 
Graham Arthur Mackenzie
Sent: Tuesday, December 13, 2016 5:02 PM
To: [email protected]
Subject: Re: [scikit-learn] scikit-learn Digest, Vol 9, Issue 42

⚠ EXT MSG:
Thanks for the speedy and helpful responses!

Actually, the thrust of my question was, "I'm assuming the fit() method for all 
three modules work the same way, so how come the example code for DTs differs 
from NB, SVMs?" Since you seem to be saying that it'll work either way, I'm 
assuming there's no real reason behind it, which was my suspicion, but just 
wanted to have it confirmed, as the inconsistency was conspicuous.

Thanks!
GAM

ps, My apologies if this is the improper way to respond to responses. I am 
receiving the Digest rather than individual messages, so this was the best I 
could think to do...

On Tue, Dec 13, 2016 at 12:38 PM, 
<[email protected]<mailto:[email protected]>> wrote:
Send scikit-learn mailing list submissions to
        [email protected]<mailto:[email protected]>

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.python.org/mailman/listinfo/scikit-learn
or, via email, send a message with subject or body 'help' to
        [email protected]<mailto:[email protected]>

You can reach the person managing the list at
        [email protected]<mailto:[email protected]>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of scikit-learn digest..."


Today's Topics:

   1. Why do DTs have a different fit protocol than NB and SVMs?
      (Graham Arthur Mackenzie)
   2. Re: Why do DTs have a different fit protocol than NB and
      SVMs? (Jacob Schreiber)
   3. Re: Why do DTs have a different fit protocol than NB and
      SVMs? (Stuart Reynolds)
   4. Re: Why do DTs have a different fit protocol than NB and
      SVMs? (Vlad Niculae)


----------------------------------------------------------------------

Message: 1
Date: Tue, 13 Dec 2016 12:14:43 -0800
From: Graham Arthur Mackenzie 
<[email protected]<mailto:[email protected]>>
To: [email protected]<mailto:[email protected]>
Subject: [scikit-learn] Why do DTs have a different fit protocol than
        NB and SVMs?
Message-ID:
        
<caguvbb72xozgcuiuaxucmz9fckirzllnv3zm4aw5tcsf-6g...@mail.gmail.com<mailto:caguvbb72xozgcuiuaxucmz9fckirzllnv3zm4aw5tcsf-6g...@mail.gmail.com>>
Content-Type: text/plain; charset="utf-8"

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.python.org/pipermail/scikit-learn/attachments/20161213/8bbeacdb/attachment-0001.html>

------------------------------

Message: 2
Date: Tue, 13 Dec 2016 12:23:00 -0800
From: Jacob Schreiber <[email protected]<mailto:[email protected]>>
To: Scikit-learn user and developer mailing list
        <[email protected]<mailto:[email protected]>>
Subject: Re: [scikit-learn] Why do DTs have a different fit protocol
        than NB and SVMs?
Message-ID:
        
<CA+ad8Ev87kFsDfkX8xUsoLFpa9x=W3Kr_wG3ue47WosO=jo...@mail.gmail.com<mailto:[email protected]>>
Content-Type: text/plain; charset="utf-8"

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]<mailto:[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]<mailto:[email protected]>
> https://mail.python.org/mailman/listinfo/scikit-learn
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.python.org/pipermail/scikit-learn/attachments/20161213/08e2e7c2/attachment-0001.html>

------------------------------

Message: 3
Date: Tue, 13 Dec 2016 12:33:48 -0800
From: Stuart Reynolds 
<[email protected]<mailto:[email protected]>>
To: Scikit-learn user and developer mailing list
        <[email protected]<mailto:[email protected]>>
Subject: Re: [scikit-learn] Why do DTs have a different fit protocol
        than NB and SVMs?
Message-ID:
        
<CAAy-kdnQ3t3gH=BbjwD_n7Zr+9gnV-X34Eke=fc=ysiw6zi...@mail.gmail.com<mailto:[email protected]>>
Content-Type: text/plain; charset="utf-8"

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]<mailto:[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]<mailto:[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]<mailto:[email protected]>
>> https://mail.python.org/mailman/listinfo/scikit-learn
>>
>>
>
> _______________________________________________
> scikit-learn mailing list
> [email protected]<mailto:[email protected]>
> https://mail.python.org/mailman/listinfo/scikit-learn
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.python.org/pipermail/scikit-learn/attachments/20161213/2d6dd8e7/attachment-0001.html>

------------------------------

Message: 4
Date: Tue, 13 Dec 2016 15:38:42 -0500
From: Vlad Niculae <[email protected]<mailto:[email protected]>>
To: Scikit-learn user and developer mailing list
        <[email protected]<mailto:[email protected]>>, Stuart 
Reynolds <[email protected]<mailto:[email protected]>>
Subject: Re: [scikit-learn] Why do DTs have a different fit protocol
        than NB and SVMs?
Message-ID: 
<[email protected]<mailto:[email protected]>>
Content-Type: text/plain; charset="utf-8"

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]<mailto:[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]<mailto:[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]<mailto:[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]<mailto:[email protected]>
>>> https://mail.python.org/mailman/listinfo/scikit-learn
>>>
>>>
>>
>> _______________________________________________
>> scikit-learn mailing list
>> [email protected]<mailto:[email protected]>
>> https://mail.python.org/mailman/listinfo/scikit-learn
>>
>>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>scikit-learn mailing list
>[email protected]<mailto:[email protected]>
>https://mail.python.org/mailman/listinfo/scikit-learn

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.python.org/pipermail/scikit-learn/attachments/20161213/45217ea3/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
scikit-learn mailing list
[email protected]<mailto:[email protected]>
https://mail.python.org/mailman/listinfo/scikit-learn


------------------------------

End of scikit-learn Digest, Vol 9, Issue 42
*******************************************

* This is an EXTERNAL EMAIL. Stop and think before clicking a link or opening 
attachments.
_______________________________________________
scikit-learn mailing list
[email protected]
https://mail.python.org/mailman/listinfo/scikit-learn

Reply via email to