Scikit-Learn
73
X = np.random.randn(n_samples, n_features)
NuSVRReg = NuSVR(kernel='linear', gamma='auto',C=1.0, nu=0.1)^M
NuSVRReg.fit(X, y)
Output
NuSVR(C=1.0, cache_size=200, coef0=0.0, degree=3, gamma='auto',
kernel='linear', max_iter=-1, nu=0.1, shrinking=True, tol=0.001,
verbose=False)
Now, once fitted, we can get the weight vector with the help of following python script:
NuSVRReg.coef_
Output
array([[-0.14904483, 0.04596145, 0.22605216, -0.08125403, 0.06564533,
0.01104285, 0.04068767, 0.2918337 , -0.13473211, 0.36006765,
-0.2185713 , -0.31836476, -0.03048429, 0.16102126, -0.29317051]])
Similarly, we can get the value of other attributes as well.
LinearSVR
It is Linear Support Vector Regression. It is similar to SVR having kernel = ‘linear’. The
difference between them is that
LinearSVR
implemented in terms of
liblinear,
while SVC
implemented in
Dostları ilə paylaş: