简体   繁体   中英

What is the logic behind the .fit() method in machine learning models?

I started machine learning with sci-kit learn and came across various models in machine learning.

In every model, there was a fit() function.

Although I read many blog posts and came to know that fit() helps us to find the parameter of the model.

For example in Linear Regression model, fit() function helps to find the slope and intercept.

But I am still not able to understand the behind logic of fit() function.

In general at least for predictive models, fit() takes data that you want to use to train some model so that it can make predictions about other related data. Each type of model has different constraints and different types of patterns it attempts to extract from the data. In one dimensional linear regression, fit() is looking for a linear (straight line) relationship in the data and finds a linear function (slope and intercept) that minimizes the sum of squared differences between the function and the data points provided.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM