简体   繁体   English

机器学习模型中.fit()方法背后的逻辑是什么?

[英]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. 我从sci-kit learning开始机器学习,并遇到了机器学习中的各种模型。

In every model, there was a fit() function. 在每个模型中,都有一个fit()函数。

Although I read many blog posts and came to know that fit() helps us to find the parameter of the model. 尽管我阅读了许多博客文章,并知道fit()可以帮助我们找到模型的参数。

For example in Linear Regression model, fit() function helps to find the slope and intercept. 例如,在线性回归模型中, fit()函数有助于查找斜率和截距。

But I am still not able to understand the behind logic of fit() function. 但是我仍然无法理解fit()函数的背后逻辑。

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. 通常,至少对于预测模型而言,fit()会获取要用于训练某些模型的数据,以便可以对其他相关数据进行预测。 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. 在一维线性回归中,fit()在数据中寻找线性(直线)关系,并找到一个线性函数(斜率和截距),该函数使函数和提供的数据点之间的平方差之和最小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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