Irrelevant play
This commit is contained in:
@@ -365,7 +365,7 @@ def correlation_loadings(D, T, P, test=True):
|
||||
|
||||
|
||||
|
||||
def cv_lpls(X, Y, Z, a_max=2, nsets=None,alpha=.5):
|
||||
def cv_lpls(X, Y, Z, a_max=2, nsets=None,alpha=.5, mean_ctr=[2,0,1]):
|
||||
"""Performs crossvalidation to get generalisation error in lpls"""
|
||||
cv_iter = select_generators.pls_gen(X, Y, n_blocks=nsets,center=False,index_out=True)
|
||||
k, l = Y.shape
|
||||
@@ -374,7 +374,7 @@ def cv_lpls(X, Y, Z, a_max=2, nsets=None,alpha=.5):
|
||||
T, W, P, Q, U, L, K, B, b0, evx, evy, evz = nipals_lpls(xcal,ycal,Z,
|
||||
a_max=a_max,
|
||||
alpha=alpha,
|
||||
mean_ctr=[2,0,1],
|
||||
mean_ctr=mean_ctr,
|
||||
verbose=False)
|
||||
for a in range(a_max):
|
||||
Yhat[a,ind,:] = b0[a][0][0] + dot(xi, B[a])
|
||||
@@ -387,7 +387,7 @@ def cv_lpls(X, Y, Z, a_max=2, nsets=None,alpha=.5):
|
||||
rmsep = sqrt(sep.mean(1))
|
||||
return rmsep, Yhat, class_err
|
||||
|
||||
def jk_lpls(X, Y, Z, a_max, nsets=None, alpha=.5):
|
||||
def jk_lpls(X, Y, Z, a_max, nsets=None, alpha=.5, mean_ctr=[2,0,1]):
|
||||
cv_iter = select_generators.pls_gen(X, Y, n_blocks=nsets,center=False,index_out=False)
|
||||
m, n = X.shape
|
||||
k, l = Y.shape
|
||||
@@ -401,7 +401,7 @@ def jk_lpls(X, Y, Z, a_max, nsets=None, alpha=.5):
|
||||
T, W, P, Q, U, L, K, B, b0, evx, evy, evz = nipals_lpls(xcal,ycal,Z,
|
||||
a_max=a_max,
|
||||
alpha=alpha,
|
||||
mean_ctr=[2,0,1],
|
||||
mean_ctr=mean_ctr,
|
||||
scale='loads',
|
||||
verbose=False)
|
||||
WWx[i,:,:] = W
|
||||
|
||||
Reference in New Issue
Block a user