什么是“合适的"? scikit-learn中的方法吗? [英] What does "fit" method in scikit-learn do?

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

问题描述

能否请您解释scikit-learn中的"fit"方法是什么?为什么有用?

我是机器学习和scikit学习的新手.

解决方案

简而言之: fitting 等于 training .然后,在对其进行训练之后,通常可以使用.predict()方法调用来使用该模型进行预测.

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

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

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

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

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

I am new in Machine Learning and scikit-learn.

解决方案

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.

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).

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.

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天全站免登陆