[scikit-learn] R user trying to learn Python
massimo di stefano
massimodisasha at gmail.com
Sun Jun 18 18:42:13 EDT 2017
Hi, along with all the great tips you received, perhaps you may find this useful:
http://www.cert.org/flocon/2011/matlab-python-xref.pdf
I know is not on-topic with your question, but I found it very useful when I start to use python (coming from R)
So I thought it was worth to post it here.
It is very old but those basic functions are pretty stable.
The python code assumes a:
from numpy import *
which others already explained you why is good practice to avoid it,
—Massimo.
> On Jun 18, 2017, at 12:02 PM, C W <tmrsg11 at gmail.com> wrote:
>
> Dear Scikit-learn,
>
> What are some good ways and resources to learn Python for data analysis?
>
> I am extremely frustrated using this thing. Everything comes after a dot! Why would you type the sam thing at the beginning of every line. It's not efficient.
>
> code 1:
> y_sin = np.sin(x)
> y_cos = np.cos(x)
>
> I know you can import the entire package without the "as np", but I see np.something as the standard. Why?
>
> Code 2:
> model = LogisticRegression()
> model.fit(X_train, y_train)
> model.score(X_test, y_test)
>
> In R, everything is saved to a variable. In the code above, what if I accidentally ran model.fit(), I would not know.
>
> Code 3:
> from sklearn import linear_model
> reg = linear_model.Ridge (alpha = .5)
> reg.fit ([[0, 0], [0, 0], [1, 1]], [0, .1, 1])
>
> In the code above, sklearn > linear_model > Ridge, one lives inside the other, it feels that there are multiple layer, how deep do I have to dig in?
>
> Can someone explain the mentality behind this setup?
>
> Thank you very much!
>
> M
> _______________________________________________
> 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