metbit.opls
Analysis and models module in metbit 7.0.1.
import metbit.oplsClasses
OPLS
Methods
__init__(self)
TODO: 1. add arg for specifying the method for performing PLS
fit(self, x, y, n_comp=None, dot=np.dot)
Fit PLS model.
Parameters
xnp.ndarrayVariable matrix with size n samples by p variables.
ynp.ndarrayDependent matrix with size n samples by 1, or a vector
n_compintNumber of components, default is None, which indicates that largest dimension which is smaller value between n and p will be used.
Returns
OPLS object
Reference
[1] Trygg J, Wold S. Projection on Latent Structure (OPLS). J Chemometrics. 2002, 16, 119-128. [2] Trygg J, Wold S. O2-PLS, a two-block (X-Y) latent variable regression (LVR) method with a integral OSC filter. J Chemometrics. 2003, 17, 53-64.
predict(self, X, n_component=None, return_scores=False)
Predict the new coming data matrx.
correct(self, x, n_component=None, return_scores=False, dot=np.dot)
Correction of X
Parameters
xnp.ndarrayData matrix with size n by c, where n is number of samples, and c is number of variables
n_componentint | NoneNumber of components. If is None, the number of components used in fitting the model is used. Default is None.
return_scoresboolReturn orthogonal scores. Default is False.
Returns
xcnp.ndarrayCorrected data, with same matrix size with input X.
tnp.ndarrayOrthogonal score, n by n_component.
predictive_score(self, n_component=None)
Parameters
n_componentintThe component number.
Returns
np.ndarray The first predictive score.
ortho_score(self, n_component=None)
Parameters
n_componentintThe component number.
Returns
np.ndarray The first orthogonal score.
predictive_scores(self)
Orthogonal loadings.
predictive_loadings(self)
Predictive loadings.
weights_y(self)
y scores.
orthogonal_loadings(self)
Orthogonal loadings.
orthogonal_scores(self)
Orthogonal scores.