[scikit-learn] Why do DTs have a different fit protocol than NB and SVMs?

Vlad Niculae zephyr14 at gmail.com
Tue Dec 13 16:11:01 EST 2016


I agree; if you're not actually doing daisy-chaining, the stateful and
more concise form `clf.fit(X.y)` looks more pythonic in my opinion.

Also it seems that the "fit returns self" convention is not documented
here [1], maybe we should briefly mention it?

http://scikit-learn.org/stable/tutorial/basic/tutorial.html

On Tue, Dec 13, 2016 at 3:45 PM, Andreas Mueller <t3kcit at gmail.com> wrote:
>
>
> On 12/13/2016 03:38 PM, Vlad Niculae wrote:
>>
>> 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.
>
>
> It is indeed enforced.
> Though I feel clf = clf.fit(X, y)
> is somewhat ugly and I would rather not have it in the docs.
> Alsok this example uses a capital Y,so two reasons to change it ;)
>
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn


More information about the scikit-learn mailing list