<html><head></head><body lang="en-GB" style="background-color: rgb(255, 255, 255); line-height: initial;"> <div style="width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);">Hope it helps. I answered in the original message</div><div style="width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);"><br></div><div style="width: 100%; font-size: initial; font-family: Calibri, 'Slate Pro', sans-serif, sans-serif; color: rgb(31, 73, 125); text-align: initial; background-color: rgb(255, 255, 255);">G</div> <table width="100%" style="background-color:white;border-spacing:0px;"> <tbody><tr><td colspan="2" style="font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"> <div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in; font-family: Tahoma, 'BB Alpha Sans', 'Slate Pro'; font-size: 10pt;"> <div><b>From: </b>C W</div><div><b>Sent: </b>Monday, 5 June 2017 00:31</div><div><b>To: </b>scikit-learn@python.org</div><div><b>Reply To: </b>Scikit-learn user and developer mailing list</div><div><b>Subject: </b>[scikit-learn] How to best understand scikit-learn and know its modules and methods?</div></div></td></tr></tbody></table><div style="border-style: solid none none; border-top-color: rgb(186, 188, 209); border-top-width: 1pt; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);"></div><br><div id="_originalContent" style=""><div dir="ltr">Dear scikit learn list,<div><br></div><div>I am new to scikit-learn. I am getting confused about LinearRegression.</div><div><br></div><div>For example,</div><div>from sklearn.datasets import load_boston</div><div>from sklearn.linear_model import LinearRegression</div><div>boston = load_boston()</div><div>X = boston.data</div><div>y = boston.target</div><div>model1 = LinearRegression()</div><div>model1.fit(X, y)</div><div>print(model.coef)</div><div><br></div><div>I got a few questions:</div><div><div>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?</div><div><br></div><div>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(...)</div></div><div><br></div><div>2) Is there a command to see what's masked under sklearn, like sklearn.datasets, sklearn.linear_model, and all of it?</div><div><br></div><div>You can check the documentation API. I think that this is the best user friendly thing that you can start with. </div><div><br></div><div>3) Why do we need load_boston() to load boston data? I thought we just imported it, so it should be ready to use.</div><div><br></div><div>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. </div><div><br></div><div>Thank you very much!</div><div><br></div><div>Mike</div></div>
<br><!--end of _originalContent --></div></body></html>