mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-15 06:52:39 +02:00
finally added pca package again
This commit is contained in:
parent
ed2aaab4bb
commit
321a75100c
5 changed files with 134 additions and 33 deletions
|
|
@ -5,13 +5,14 @@ Created on 24 Feb 2014
|
|||
'''
|
||||
|
||||
import numpy as np
|
||||
from linalg import PCA
|
||||
from GPy.util.pca import pca
|
||||
|
||||
def initialize_latent(init, input_dim, Y):
|
||||
Xr = np.random.randn(Y.shape[0], input_dim)
|
||||
if init == 'PCA':
|
||||
PC = PCA(Y, input_dim)[0]
|
||||
p = pca(Y)
|
||||
PC = p.project(Y, min(input_dim, Y.shape[1]))
|
||||
Xr[:PC.shape[0], :PC.shape[1]] = PC
|
||||
else:
|
||||
pass
|
||||
return Xr
|
||||
return Xr, p.fracs[:input_dim]
|
||||
Loading…
Add table
Add a link
Reference in a new issue