如何在scikit-learn中得到方程?

far*_*ari 3 python scikit-learn

我想用scikit-learn来计算某些数据的等式.我使用此代码将曲线拟合到我的数据:

svr_lin = SVR(kernel='linear', C=1e3)
y_lin = svr_lin.fit(X, y).predict(Xp)
Run Code Online (Sandbox Code Playgroud)

但我不知道应该怎样做才能得到拟合模型的精确方程.你知道我怎么能得到这些方程吗?

MhF*_*ani 8

这是一个例子:

from sklearn.datasets import load_boston
from sklearn.svm import  SVR
boston = load_boston()
X = boston.data
y = boston.target
svr = SVR(kernel='linear')
svr.fit(X,y);
print('weights: ')
print(svr.coef_)
print('Intercept: ')
print(svr.intercept_)
Run Code Online (Sandbox Code Playgroud)

输出是:

weights: 
[[-0.14125916  0.03619729 -0.01672455  1.35506651 -2.42367649  5.19249046
  -0.0307062  -0.91438543  0.17264082 -0.01115169 -0.64903308  0.01144761
  -0.33160831]]
Intercept: 
[ 11.03647437]
Run Code Online (Sandbox Code Playgroud)

对于线性核,拟合模型是超平面(ω ^ [T] x + b = 0),其中ω是权重向量,b是截距.