[scikit-learn] Issue with Sklearn.Logistic Regression
mrschots
maykonschots at gmail.com
Sun Nov 1 17:44:31 EST 2020
You should instantiate LogisticRegression() before fitting.
logreg = LogisticRegression().fit(Xnp,ynp)
[]’s
Maykon Schots
Em dom., 1 de nov. de 2020 às 23:41, The Helmbolds via scikit-learn <
scikit-learn at python.org> escreveu:
> What parentheses?
> Enclosing what?
>
> "You won't find the right answers if you don't ask the right questions!"
> (Robert Helmbold, 2013)
>
>
> On Sunday, November 1, 2020, 02:58:46 PM MST, Guillaume Lemaître <
> g.lemaitre58 at gmail.com> wrote:
>
>
> You forgot the parentheses to instantiate the object LogisticRegression
>
> On Sun, 1 Nov 2020 at 22:55, The Helmbolds via scikit-learn <
> scikit-learn at python.org> wrote:
>
> Here's my ynp and Xnp arrays:
>
> Print ynp
> [0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
> 0 1 0 0 0 0 0 0 1 1 0 0 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 1 1 0 1 1 0 1 0 0 1
> 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0
> 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1
> 1 1 1 1 1 1 1 1 1 1 1 1]
> Shape of ynp = 160
>
> Print Xnp
> [-3.00000000e+00 -2.95000000e+00 -2.90000000e+00 -2.85000000e+00
> -2.80000000e+00 -2.75000000e+00 -2.70000000e+00 -2.65000000e+00
> -2.60000000e+00 -2.55000000e+00 -2.50000000e+00 -2.45000000e+00
> -2.40000000e+00 -2.35000000e+00 -2.30000000e+00 -2.25000000e+00
> -2.20000000e+00 -2.15000000e+00 -2.10000000e+00 -2.05000000e+00
> -2.00000000e+00 -1.95000000e+00 -1.90000000e+00 -1.85000000e+00
> -1.80000000e+00 -1.75000000e+00 -1.70000000e+00 -1.65000000e+00
> -1.60000000e+00 -1.55000000e+00 -1.50000000e+00 -1.45000000e+00
> -1.40000000e+00 -1.35000000e+00 -1.30000000e+00 -1.25000000e+00
> -1.20000000e+00 -1.15000000e+00 -1.10000000e+00 -1.05000000e+00
> -1.00000000e+00 -9.50000000e-01 -9.00000000e-01 -8.50000000e-01
> -8.00000000e-01 -7.50000000e-01 -7.00000000e-01 -6.50000000e-01
> -6.00000000e-01 -5.50000000e-01 -5.00000000e-01 -4.50000000e-01
> -4.00000000e-01 -3.50000000e-01 -3.00000000e-01 -2.50000000e-01
> -2.00000000e-01 -1.50000000e-01 -1.00000000e-01 -5.00000000e-02
> -2.28983499e-15 5.00000000e-02 1.00000000e-01 1.50000000e-01
> 2.00000000e-01 2.50000000e-01 3.00000000e-01 3.50000000e-01
> 4.00000000e-01 4.50000000e-01 5.00000000e-01 5.50000000e-01
> 6.00000000e-01 6.50000000e-01 7.00000000e-01 7.50000000e-01
> 8.00000000e-01 8.50000000e-01 9.00000000e-01 9.50000000e-01
> 1.00000000e+00 1.05000000e+00 1.10000000e+00 1.15000000e+00
> 1.20000000e+00 1.25000000e+00 1.30000000e+00 1.35000000e+00
> 1.40000000e+00 1.45000000e+00 1.50000000e+00 1.55000000e+00
> 1.60000000e+00 1.65000000e+00 1.70000000e+00 1.75000000e+00
> 1.80000000e+00 1.85000000e+00 1.90000000e+00 1.95000000e+00
> 2.00000000e+00 2.05000000e+00 2.10000000e+00 2.15000000e+00
> 2.20000000e+00 2.25000000e+00 2.30000000e+00 2.35000000e+00
> 2.40000000e+00 2.45000000e+00 2.50000000e+00 2.55000000e+00
> 2.60000000e+00 2.65000000e+00 2.70000000e+00 2.75000000e+00
> 2.80000000e+00 2.85000000e+00 2.90000000e+00 2.95000000e+00
> 3.00000000e+00 3.05000000e+00 3.10000000e+00 3.15000000e+00
> 3.20000000e+00 3.25000000e+00 3.30000000e+00 3.35000000e+00
> 3.40000000e+00 3.45000000e+00 3.50000000e+00 3.55000000e+00
> 3.60000000e+00 3.65000000e+00 3.70000000e+00 3.75000000e+00
> 3.80000000e+00 3.85000000e+00 3.90000000e+00 3.95000000e+00
> 4.00000000e+00 4.05000000e+00 4.10000000e+00 4.15000000e+00
> 4.20000000e+00 4.25000000e+00 4.30000000e+00 4.35000000e+00
> 4.40000000e+00 4.45000000e+00 4.50000000e+00 4.55000000e+00
> 4.60000000e+00 4.65000000e+00 4.70000000e+00 4.75000000e+00
> 4.80000000e+00 4.85000000e+00 4.90000000e+00 4.95000000e+00]
> Shape of Xnp = 160
> Press ENTER to continue =
>
> Now Call Logistic Regression
>
> ---------------------------------------------------------------------------TypeError Traceback (most recent call last)<ipython-input-3-300811cacc0b> in <module> 103 104 aprint("Now Call Logistic Regression")--> 105 logreg = LogisticRegression.fit(Xnp, ynp) 106 aprint("Print logreg output") 107 print(logreg)
> TypeError: fit() missing 1 required positional argument: 'y'
>
>
> Eh!?!?
>
> What happened*???*
>
>
>
>
>
> "You won't find the right answers if you don't ask the right questions!"
> (Robert Helmbold, 2013)
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
>
>
>
> --
> Guillaume Lemaitre
> Scikit-learn @ Inria Foundation
> https://glemaitre.github.io/
> _______________________________________________
> 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
>
--
Schots
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/scikit-learn/attachments/20201101/bee6d9cc/attachment-0001.html>
More information about the scikit-learn
mailing list