Scikit-Learn


Output  array([[0.5, 0.5]])  Similarly, we can get the value of other attributes as follows:  SVCClf.predict([[-0.5,-0.8]])  Output



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

Output 
array([[0.5, 0.5]]) 
Similarly, we can get the value of other attributes as follows: 
SVCClf.predict([[-0.5,-0.8]]) 
Output 
array([1]) 
 
SVCClf.n_support_ 
Output 
array([1, 1]) 
 
SVCClf.support_vectors_ 
Output 
array([[-1., -1.], 
[ 1., 1.]]) 
 


Scikit-Learn
69 
SVCClf.support_ 
Output 
array([0, 2]) 
 
SVCClf.intercept_ 
Output 
array([-0.]) 
 
SVCClf.fit_status_ 
Output 

NuSVC
 
NuSVC is Nu Support Vector Classification. It is another class provided by scikit-learn 
which can perform multi-class classification. It is like SVC but NuSVC accepts slightly 
different sets of parameters. The parameter which is different from SVC is as follows: 

nu:
float, optional, default = 0.5 
It represents an upper bound on the fraction of training errors and a lower bound of the 
fraction of support vectors. Its value should be in the interval of (o,1]. 
Rest of the parameters and attributes are same as of SVC. 
Implementation Example 
We can implement the same example using 
sklearn.svm.NuSVC
class also. 
import numpy as np 
X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]]) 
y = np.array([1, 1, 2, 2]) 
from sklearn.svm import NuSVC 
NuSVCClf = NuSVC(kernel='linear',gamma='scale', shrinking=False,) 
NuSVCClf.fit(X, y) 
 
Output 
NuSVC(cache_size=200, class_weight=None, coef0=0.0, 


Scikit-Learn
70 
decision_function_shape='ovr', degree=3, gamma='scale', kernel='linear', 
max_iter=-1, nu=0.5, probability=False, random_state=None, 
shrinking=False, tol=0.001, verbose=False)
We can get the outputs of rest of the attributes as did in the case of SVC. 

Yüklə 1,92 Mb.

Dostları ilə paylaş:
1   ...   59   60   61   62   63   64   65   66   ...   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ə