def YYT(Y, n_components=None, DEBUG=False):
"""
Param:
Y: n x d
n_components: use 'mle' to guess
Returns:
P: d x d'
QT: d' x d
"""
newdata = Y.copy()
model = PCA(n_components=n_components)
if len(newdata.shape) != 2:
newdata = newdata.reshape((newdata.shape[0], -1))
#TODO center data
model.fit(newdata)
if DEBUG: from IPython import embed; embed()
return model.components_.T, model.components_
#def GSVD(Z, Y):
# NotImplementedError
# return [U,V,X,C,S]
评论列表
文章目录