scikit learn机器学习包中包含了偏最小二乘回归,所以可以调用对应的函数来实现
class sklearn.cross_decomposition.PLSRegression(n_components=2, scale=True, max_iter=500, tol=1e-06, copy=True)
参数信息:
Parameters: | n_components : int, (default 2)
scale : boolean, (default True)
max_iter : an integer, (default 500)
tol : non-negative real
copy : boolean, default True
|
---|---|
Attributes: | x_weights_ : array, [p, n_components]
y_weights_ : array, [q, n_components]
x_loadings_ : array, [p, n_components]
y_loadings_ : array, [q, n_components]
x_scores_ : array, [n_samples, n_components]
y_scores_ : array, [n_samples, n_components]
x_rotations_ : array, [p, n_components]
y_rotations_ : array, [q, n_components]
coef_: array, [p, q] :
n_iter_ : array-like
|
Notes
Matrices:
Are computed such that: