我做了回归
basket.purchase_Date.now.strftime('%Y-%m-%d %H:%M %z')
=> "2016-04-26 22:48 -0400"
然后我有系数
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)
我正在寻找Y1和Y2的等式。
我检查了
coeffs = pls2.coef_
[[ 1.53732139 1.5363102 ]
[ 0.97075672 1.0153412 ]
[ 1.19152707 1.23299069]]
但它不等于Y1 = coeffs [0] * X1 + coeffs [1] * X2 + coeffs [2] * X2
我也试图申请pls2.predict
,但仍未成功。
如何获得Y1和Y2的等式?
答案 0 :(得分:1)
我去了predict
方法并找到了解决方案。 {} - 表示向量
{Y_predicted} = normalized({X}) x pls.coef_ + {Y_o}mean