简体   繁体   English

sklearn.decomposition 中的 PCA 中的 fit、transform 和 fit_transform 有什么作用?

[英]What does fit, transform, and fit_transform do in PCA available in sklearn.decomposition?

I am trying to mimic the behavior of PCA class available in sklearn.decomposition .我试图模仿sklearn.decomposition可用的PCA类的行为。

I have wrote a method which computes the SVD but I am not sure what does fit() , tranform() , and fit_transform() do without which I'm not able to proceed further.我已经写了计算SVD的方法,但我不知道是什么fit() tranform()fit_transform()做没有它,我不能够继续进行。

I think fit() computes the svd and the singular values can be accessed using the singular_values_ attribute but I don't know about the remaining two methods.我认为fit()计算 svd 并且可以使用singular_values_属性访问奇异值,但我不知道其余两种方法。

In the docs you can see a general explanation of fit() , transform() , and fit_transform() :文档中,您可以看到fit()transform()fit_transform()的一般解释:

[...] a fit method, which learns model parameters (eg mean and standard deviation for normalization) from a training set, and a transform method which applies this transformation model to unseen data. [...] 一种从训练集学习模型参数(例如用于归一化的均值和标准差)的fit方法,以及一种将该转换模型应用于未见数据的transform方法。 fit_transform may be more convenient and efficient for modelling and transforming the training data simultaneously. fit_transform可能更方便、更高效地同时对训练数据进行建模和转换。

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

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