简体   繁体   English

我们可以直接使用 .fit_transform() 吗?

[英]Can we use .fit_transform() directly?

from sklearn.preprocessing import MinMaxScaler()
scaler = MinMaxScaler()

can I directly do:我可以直接做:

scaled_data = scaler.fit_transform(mymatrix)

without doing scaler.fit(mymatrix) first?scaler.fit(mymatrix)

If not, why so?如果不是,为什么会这样? What is the difference?有什么不同? Doesnt scaler.fit_transform() function already compute the variance and mean values too before transforming?在转换之前, scaler.fit_transform()函数是否已经计算了方差和平均值?

正如您在此处的文档中所见,您可以,因为fit_transform首先执行fit(),然后再应用transform()

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

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