mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-04 01:02:39 +02:00
introduce deprecation path to empirical_samples in initialize_latent
This commit is contained in:
parent
92fb49d001
commit
55bcc27a2e
1 changed files with 15 additions and 1 deletions
|
|
@ -5,17 +5,31 @@ Created on 24 Feb 2014
|
|||
"""
|
||||
|
||||
import numpy as np
|
||||
import warnings
|
||||
from ..util.pca import PCA
|
||||
|
||||
|
||||
def initialize_latent(init, input_dim, Y):
|
||||
"""
|
||||
:param init: initialization method for the latent space, 'PCA' or 'random'
|
||||
"""
|
||||
# dealing with depcrecated initialization method
|
||||
# should be remove along the next major release
|
||||
if init == "empirical_samples":
|
||||
warnings.warn(
|
||||
"Deprecated initialization method 'empirical_samples'. "
|
||||
"Use 'random' instead.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
init == "random"
|
||||
|
||||
Xr = np.asfortranarray(np.random.normal(0, 1, (Y.shape[0], input_dim)))
|
||||
if "PCA" == init:
|
||||
p = PCA(Y)
|
||||
PC = p.project(Y, min(input_dim, Y.shape[1]))
|
||||
Xr[: PC.shape[0], : PC.shape[1]] = PC
|
||||
var = 0.1 * p.fracs[:input_dim]
|
||||
elif init == "empirical_samples":
|
||||
elif init == "random":
|
||||
from ..util.linalg import tdot
|
||||
from ..util import diag
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue