scikit_learn中的fit(),fit_transform()和transform()有什么区别? [英] what is the difference between fit() ,fit_transform() and transform() in scikit_learn?

查看:78
本文介绍了scikit_learn中的fit(),fit_transform()和transform()有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是用于特征缩放的代码,其中我正在使用 fit_transform() transform():

This is code for feature scaling in which i am using fit_transform() and transform():

##Feature scaling
from sklearn.preprocessing import StandardScaler
sc_x=StandardScaler()
X_train=sc_x.fit_transform(X_train)
X_test=sc_x.transform(X_test)

推荐答案

fit 意味着使模型适合所提供的数据.这是模型从数据中学习"的地方.

fit means to fit the model to the data being provided. This is where the model "learns" from the data.

transform 意味着根据拟合的模型转换数据(产生模型输出).

transform means to transform the data (produce model outputs) according to the fitted model.

fit_transform 意味着同时进行-将模型拟合到数据,然后根据拟合的模型转换数据.调用 fit_transform 是一种便利,可以避免在同一输入上依次调用 fit transform .

fit_transform means to do both - Fit the model to the data, then transform the data according to the fitted model. Calling fit_transform is a convenience to avoid needing to call fit and transform sequentially on the same input.

这篇关于scikit_learn中的fit(),fit_transform()和transform()有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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