Home python Logistic regression in Python

Logistic regression in Python




Here is the course from the course

y_pred_train = logreg.predict (x_train)
y_predict_train = logreg.predict_proba (x_train) [:, 1]
logreg.score (x_test, y_train)

Here is a good explanation I found.

model.predict (x_test) – predict the value of the target variable

model.predict_proba () – to give “degree of confidence” in response
(probability) – for some models

model.score () – Methods of evaluation methods are built in most models
Quality of operation

1) I do not really understand what the degree of confidence mean? And why is it not possible to answer, in which 100% confidence?

2) How does SCORE () evaluate the model operation if x_train and y_train are applied to the input?
Although logic should Y_PRED and Y_TRAIN?
And in general what does the work rating mean?

Somewhere speaks about the determinant, although I am not familiar with this concept.

score (self, x, y, sample_weight = none) [SOURCE] RETURNS THE COEFFICIENT OF DETERMINATION R ^ 2 OF THE PREDICTION. … and Constant Model That Always Predicts The Expected Value of Y, Disregarding The Input Features, Would GET A R ^ 2 SCORE OF 0.0. From Sklearn Documentation

  1. and last, why do we all assign different variables?

    why not
    A = Predict (X_TEST)
    B = A.Predict_Proba ()

I suspect that it came out of the hands, due to the fact that I had defined in advance Random_state, that is, how many times do not cause Predict (), the coefficients or the weight will be the same.
But I’m not very sure of it)

Answer 1, Authority 100%

In your previous question, you advised you to read at least some literature regarding the topic, well, at least for younger schoolchildren. It seems that you have not listened to the Council. Because on the question it is clear that there is no real promotion in understanding what you do how you did not have it never, well, except that you looked at the formats of three more teams, and without realizing what they do and in general – why is it all .

Nevertheless, I will try to answer

1) I do not really understand what the degree of confidence mean? And why it is impossible
give an answer in which 100% confidence?

In a method that you seem to “study”, the result is obtained in the form of a certain number ranging from zero to one. For some (many) tasks – this is exactly what is needed – to show that both options are possible and show, what is the likelihood that the object belongs to one class or another. For other tasks (there are also many too), you need to give an absolutely unequivocal answer, to which class the answer is owned. In this case, the response to the first embodiment using the response function is given to the two-digit logic “0” – “1”.
At the same time, it is necessary to understand that the answer will be with an error, which should also be appreciated. (see below)

2) as SCORE () evaluates the model operation if x_train is applied to the input and
y_train? Although logic should Y_PRED and Y_TRAIN? And in general, what
So evaluation of work?

It is X_TRAIN and Y_TRAIN and must be fed to the input of this function. The function, knowing what should be the response of the y_train model performs the classification task, and then compares the resulting response with the expected for each X_TRAIN. The assessment will indicate the Accuracy index for (binary) classification and the value of the determination coefficient R ^ 2 for regression models.

And last, why we all assign different variables?

why it is impossible a = predict (x_test) b = a.predict_proba ()

Something strange you have written. At the same time, you ask us to tell you why you they assign them?
The idea should be

a = model.predict (x_test)
A = Model.Predict_Proba (X_TEST)

and want to assign different things – then

a = model.predict (x_test)
B = Model.Predict_Proba (X_TEST) 

Actually, the answers to all these questions can be found directly in the documentation:
https://scikit-learn.org/stable/modules/ generated / sklearn.lininear_model.logisticregregression.html

that is, how many times do not cause predict (), the coefficients or weight will be the same

And why should they be different if you use the same model and the same data?

We repeat once again – Knowledge of the format of Fit, Predict or Score not Does a person Machine Training Specialist.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions