“适合"是什么意思?方法在 scikit-learn 中做什么? [英] What does the "fit" method in scikit-learn do?

查看:16
本文介绍了“适合"是什么意思?方法在 scikit-learn 中做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能解释一下什么是适合"吗?scikit-learn 中的方法呢?为什么有用?

Could you please explain what the "fit" method in scikit-learn does? Why is it useful?

推荐答案

简而言之:拟合等于训练.然后,经过训练后,模型可用于进行预测,通常使用 .predict() 方法调用.

In a nutshell: fitting is equal to training. Then, after it is trained, the model can be used to make predictions, usually with a .predict() method call.

详细说明:将模型拟合到(即使用 .fit() 方法)训练数据本质上是建模过程的训练部分.它通过所使用的算法找到指定方程的系数(例如上面umutto的线性回归示例).

To elaborate: Fitting your model to (i.e. using the .fit() method on) the training data is essentially the training part of the modeling process. It finds the coefficients for the equation specified via the algorithm being used (take for example umutto's linear regression example, above).

然后,对于分类器,您可以使用 predict 方法对传入的数据点(来自测试集或其他)进行分类.或者,在回归的情况下,当 predict 用于传入数据点时,您的模型将进行内插/外推.

Then, for a classifier, you can classify incoming data points (from a test set, or otherwise) using the predict method. Or, in the case of regression, your model will interpolate/extrapolate when predict is used on incoming data points.

还应注意,有时适合"命名法用于非机器学习方法,例如缩放器和其他预处理步骤.在这种情况下,您只是将指定的函数应用"到您的数据,就像使用最小-最大缩放器、TF-IDF 或其他转换一样.

It also should be noted that sometimes the "fit" nomenclature is used for non-machine-learning methods, such as scalers and other preprocessing steps. In this case, you are merely "applying" the specified function to your data, as in the case with a min-max scaler, TF-IDF, or other transformation.

注意:这里有一些参考资料...

Note: here are a couple of references...

这篇关于“适合"是什么意思?方法在 scikit-learn 中做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆