sklearn.svm.libsvm
.fit¶
-
sklearn.svm.libsvm.
fit
()¶ Train the model using libsvm (low-level method)
- Parameters
- Xarray-like, dtype=float64, size=[n_samples, n_features]
- Yarray, dtype=float64, size=[n_samples]
target vector
- svm_type{0, 1, 2, 3, 4}, optional
Type of SVM: C_SVC, NuSVC, OneClassSVM, EpsilonSVR or NuSVR respectively. 0 by default.
- kernel{‘linear’, ‘rbf’, ‘poly’, ‘sigmoid’, ‘precomputed’}, optional
Kernel to use in the model: linear, polynomial, RBF, sigmoid or precomputed. ‘rbf’ by default.
- degreeint32, optional
Degree of the polynomial kernel (only relevant if kernel is set to polynomial), 3 by default.
- gammafloat64, optional
Gamma parameter in rbf, poly and sigmoid kernels. Ignored by other kernels. 0.1 by default.
- coef0float64, optional
Independent parameter in poly/sigmoid kernel. 0 by default.
- tolfloat64, optional
Numeric stopping criterion (WRITEME). 1e-3 by default.
- Cfloat64, optional
C parameter in C-Support Vector Classification. 1 by default.
- nufloat64, optional
0.5 by default.
- epsilondouble, optional
0.1 by default.
- class_weightarray, dtype float64, shape (n_classes,), optional
np.empty(0) by default.
- sample_weightarray, dtype float64, shape (n_samples,), optional
np.empty(0) by default.
- shrinkingint, optional
1 by default.
- probabilityint, optional
0 by default.
- cache_sizefloat64, optional
Cache size for gram matrix columns (in megabytes). 100 by default.
- max_iterint (-1 for no limit), optional.
Stop solver after this many iterations regardless of accuracy (XXX Currently there is no API to know whether this kicked in.) -1 by default.
- random_seedint, optional
Seed for the random number generator used for probability estimates. 0 by default.
- Returns
- supportarray, shape=[n_support]
index of support vectors
- support_vectorsarray, shape=[n_support, n_features]
support vectors (equivalent to X[support]). Will return an empty array in the case of precomputed kernel.
- n_class_SVarray
number of support vectors in each class.
- sv_coefarray
coefficients of support vectors in decision function.
- interceptarray
intercept in decision function
- probA, probBarray
probability estimates, empty array for probability=False