• score function in linear regression model

    From Fatemeh Heydari@21:1/5 to All on Sun Oct 23 05:11:10 2022
    Hi every one !

    Using sklearn and linear model I made a linear regression and I reached out to a function named "score". Does anyone know what does it exactly calculate?

    The code for this function is like this:
    model.score(X,Y)

    Thanks in advance!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Reto@21:1/5 to Fatemeh Heydari on Mon Oct 24 07:06:44 2022
    On Sun, Oct 23, 2022 at 05:11:10AM -0700, Fatemeh Heydari wrote:
    model.score(X,Y)

    That will basically check how good your model is.

    It takes a bunch of X values with known values, which you provide in Y
    and compares the output of model.Predict(X) with the Y's and gives you
    some metrics as to how good that performed.

    In the case of linear regression that be R^2, the coefficient of determination of the prediction.

    Cheers,
    Reto

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Fatemeh Heydari@21:1/5 to Reto on Tue Oct 25 23:18:21 2022
    On Monday, October 24, 2022 at 7:14:10 AM UTC-7, Reto wrote:
    On Sun, Oct 23, 2022 at 05:11:10AM -0700, Fatemeh Heydari wrote:
    model.score(X,Y)

    That will basically check how good your model is.

    It takes a bunch of X values with known values, which you provide in Y
    and compares the output of model.Predict(X) with the Y's and gives you
    some metrics as to how good that performed.

    In the case of linear regression that be R^2, the coefficient of determination
    of the prediction.

    Cheers,
    Reto


    Dear Reto
    Thanks for your attention. But I calculated R^2 for the model with the code : r2_score(predictedY,Y)
    and I got different result from the "score " function. I wish to know what mathematical formulation is behind this function

    Thanks again

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas Passin@21:1/5 to Fatemeh Heydari on Wed Oct 26 13:44:55 2022
    There's a fairly good rundown of score() here:

    "[Python/Sklearn] How does .score() works?" https://www.kaggle.com/getting-started/27261

    On 10/26/2022 2:18 AM, Fatemeh Heydari wrote:
    On Monday, October 24, 2022 at 7:14:10 AM UTC-7, Reto wrote:
    On Sun, Oct 23, 2022 at 05:11:10AM -0700, Fatemeh Heydari wrote:
    model.score(X,Y)

    That will basically check how good your model is.

    It takes a bunch of X values with known values, which you provide in Y
    and compares the output of model.Predict(X) with the Y's and gives you
    some metrics as to how good that performed.

    In the case of linear regression that be R^2, the coefficient of determination
    of the prediction.

    Cheers,
    Reto


    Dear Reto
    Thanks for your attention. But I calculated R^2 for the model with the code : r2_score(predictedY,Y)
    and I got different result from the "score " function. I wish to know what mathematical formulation is behind this function

    Thanks again

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)