Scikit-Learn


Output  array([[0.4, 0.4]])  Similarly, we can get the value of other attributes as follows:  SVRReg.predict([[1,1]])  Output



Yüklə 1,92 Mb.
Pdf görüntüsü
səhifə66/124
tarix23.02.2023
ölçüsü1,92 Mb.
#101394
1   ...   62   63   64   65   66   67   68   69   ...   124
sklearn

Output 
array([[0.4, 0.4]]) 
Similarly, we can get the value of other attributes as follows: 
SVRReg.predict([[1,1]]) 
Output 
array([1.1]) 
Similarly, we can get the values of other attributes as well.
NuSVR
 
NuSVR is Nu Support Vector Regression. It is like NuSVC, but NuSVR uses a parameter 
nu
to control the number of support vectors. And moreover, unlike NuSVC where 
nu
replaced 
C
parameter, here it replaces 
epsilon.
Implementation Example 
Following Python script uses 
sklearn.svm.SVR
 
class: 
from sklearn.svm import NuSVR 
import numpy as np 
n_samples, n_features = 20, 15 
np.random.seed(0) 
y = np.random.randn(n_samples) 


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 

Yüklə 1,92 Mb.

Dostları ilə paylaş:
1   ...   62   63   64   65   66   67   68   69   ...   124




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə