[scikit-learn] How to best understand scikit-learn and know its modules and methods?

Jacob Schreiber jmschreiber91 at gmail.com
Mon Jun 5 00:49:06 EDT 2017


Everything will disappear if you don't save it. However, if you do ```clf =
LinearRegression().fit(X, y)``` then the model is saved in the variable
`clf`.

On Sun, Jun 4, 2017 at 4:06 PM, C W <tmrsg11 at gmail.com> wrote:

> Yes, they make a lot sense. Thanks!
>
> I wanted to ask a follow-up:
>
> > LinearRegression().fit(X, y)
> When I do this, where is everything saved? Or does it disappear after I
> run it?
>
> Thank you!
>
> On Sun, Jun 4, 2017 at 6:40 PM, Guillaume Lemaitre <g.lemaitre58 at gmail.com
> > wrote:
>
>> Hope it helps. I answered in the original message
>>
>> G
>> *From: *C W
>> *Sent: *Monday, 5 June 2017 00:31
>> *To: *scikit-learn at python.org
>> *Reply To: *Scikit-learn user and developer mailing list
>> *Subject: *[scikit-learn] How to best understand scikit-learn and know
>> its modules and methods?
>>
>> Dear scikit learn list,
>>
>> I am new to scikit-learn. I am getting confused about LinearRegression.
>>
>> For example,
>> from sklearn.datasets import load_boston
>> from sklearn.linear_model import LinearRegression
>> boston = load_boston()
>> X = boston.data
>> y = boston.target
>> model1 = LinearRegression()
>> model1.fit(X, y)
>> print(model.coef)
>>
>> I got a few questions:
>> 1) When I do model1.fit(X, y), don't I have to save it? Does object
>> model1 automatically gets trained/updated? Since I don't see any output,
>> how do I know what has been done to the model1?
>>
>> The model has been fitted (trained in place). model1 will contain all
>> info learnt directly. In addition, the output will be a fitted model1
>> because fit return self. Normally, model1.fit(X,y) will print
>> LinearRegression(...)
>>
>> 2) Is there a command to see what's masked under sklearn, like
>> sklearn.datasets, sklearn.linear_model, and all of it?
>>
>> You can check the documentation API. I think that this is the best user
>> friendly thing that you can start with.
>>
>> 3) Why do we need load_boston() to load boston data? I thought we just
>> imported it, so it should be ready to use.
>>
>> Load_boston() is a helper function which will load the data. Importing
>> load_boston will import the function not the data. Calling the imported
>> function will load the data.
>>
>> Thank you very much!
>>
>> Mike
>>
>>
>> _______________________________________________
>> scikit-learn mailing list
>> scikit-learn at python.org
>> https://mail.python.org/mailman/listinfo/scikit-learn
>>
>>
>
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20170604/2e7f6217/attachment-0001.html>


More information about the scikit-learn mailing list