我有第一批差异的时间序列,我应用PCA,使用scikit获得第一台PC。
# data is a timeseries of first differences
pca = PCA(n_components=1)
pca.fit(data)
pc1_trans = pca.transform(data)
pc1_dot = numpy.dot( data, pca.components_.T)
plt.plot( numpy.cumsum( pc1_dot ) )
plt.plot( numpy.cumsum( pc1_trans ) ) 我认为,原始数据和第一个组件之间的点积(投影)结果将产生与调用pca.transform相同的结果,但情况并非如此(下面的结果;橙色线是来自转换的数据)。为什么会这样呢?

发布于 2019-05-12 19:13:53
找到答案here
scikit PCA向您展示了对非平均数据的转换,因此它们是等价的:
pc1_trans = pca.transform(data)
pc1_dot = numpy.dot( data - data.mean(), pca.components_.T)https://stackoverflow.com/questions/56102401
复制相似问题