[英]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 atransform
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.