Home python Machine training. What do methods fit () and predict ()

Machine training. What do methods fit () and predict ()

Author

Date

Category

Meet machine learning using Python and Sklearn Library.
There are 2 methods Fit () and Predict ()
Honestly after some sites I understand that they do very blurry.

lin_reg.fit (x_train [num_features], y_train)

fit (x, y) training (training) models on the Educational sample X, Y -Citata from the forum

and what does it mean?

1) The model looks at X_TRAIN, gives a random number and combines it with y_train?

2) Model looks at x_train and y_train and trying to find some interconnections or customize coefficients?

Here I have a stupor.

Predict (x) Prediction on X – Quote.

So the model is configured and can we serve it input?

y_pred = lin_reg.predict (x_train [num_features])

But here it is confused here why for training and predictions we eradicate the same data?
Will there be a failure or model will not remember all the answers and give a 100% result?


Answer 1, Authority 100%

fit (x, y) Training (training) models on a training sample x, y-quotation
From the forum

and what does it mean?

2) The model looks at x_train and y_train and trying to find some
Relationships or customize coefficients?

just like this. The model is trying to find such coefficients (well, if we primitively speak, real models can be very complicated than a simple set of coefficients) to minimize the difference between the prediction of the model x_train and the real value of Y_TRAIN.

PREDICT (X) Prediction on X-Something Quote.

So the model is configured and can we serve it input?

Yes, so.

y_pred = lin_reg.predict (x_train [num_features]) but here
confuses why for training and predictions we screamed alone and those
same data? Will there be a failure or model will not remember all the answers and
will give a 100% result?

A rather complicated model can remember all the data and give data to the data for learning 100% accuracy, but the goal of machine learning is not in this, but that the model is well predicted on those data they have not seen.
In this case, they simply check if the model was learned in general, and then cases are different. It happens, you learn the model, and she has not learned anything at all. So it’s just a primitive “Sanity Check”, and not a real “combat” situation. In real life, of course, predict already on X_Test test data.

In general, the topic of machine learning is quite complex, it can be studied for many years. You have a very novice questions, try to read some more articles and literature, there are answers to all these questions. It is better to start “from the stove” – ​​with the theory, and not immediately apply libraries, not understanding that they do at all.

p.s.

1) The model looks at X_TRAIN, gives a random number and combines it with
y_train?

In some models of machine learning inside, something like that is really happening, but not in all. The model can search for the necessary coefficients in fairly different ways. It is important to understand that the training model is usually a complex iterative process. The model selects somehow the coefficients (it happens that it is random), it looks the discrepancy with the goal if it is large – “thinks” where to move, tries some other coefficients, etc., until it reaches the right result, or will not be released The number of iterations reserved for training.

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