Reputation: 474
I made a regression
import numpy as np
from sklearn.cross_decomposition import PLSRegression
X = [[0., 0., 1.], [1.,0.,0.], [2.,2.,2.], [2.,5.,4.]]
Y = [[0.1, -0.2], [0.9, 1.1], [6.2, 5.9], [11.9, 12.3]]
pls2 = PLSRegression(n_components=2)
pls2.fit(X, Y)
Then i have coefficients
coeffs = pls2.coef_
[[ 1.53732139 1.5363102 ]
[ 0.97075672 1.0153412 ]
[ 1.19152707 1.23299069]]
I was looking for an equations for Y1 and Y2.
I checked
Y1 = coeffs [0] * X1 + coeffs [1] * X2 + coeffs [2] * X2
But it is not equal to pls2.predict
Also I tried to apply pls2.x_weights_
, but still no success.
How can I get equation for Y1 and Y2 ?
Upvotes: 0
Views: 764
Reputation: 474
I went to predict
method and found the solution. {} - means vectors
{Y_predicted} = normalized({X}) x pls.coef_ + {Y_o}mean
Upvotes: 2