snowflake.ml.modeling.svm.NuSVC¶
- class snowflake.ml.modeling.svm.NuSVC(*, nu=0.5, kernel='rbf', degree=3, gamma='scale', coef0=0.0, shrinking=True, probability=False, tol=0.001, cache_size=200, class_weight=None, verbose=False, max_iter=- 1, decision_function_shape='ovr', break_ties=False, random_state=None, input_cols: Optional[Union[str, Iterable[str]]] = None, output_cols: Optional[Union[str, Iterable[str]]] = None, label_cols: Optional[Union[str, Iterable[str]]] = None, drop_input_cols: Optional[bool] = False, sample_weight_col: Optional[str] = None)¶
Bases:
BaseTransformer
Nu-Support Vector Classification For more details on this class, see sklearn.svm.NuSVC
- nu: float, default=0.5
An upper bound on the fraction of margin errors (see User Guide) and a lower bound of the fraction of support vectors. Should be in the interval (0, 1].
- kernel: {‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, ‘precomputed’} or callable, default=’rbf’
Specifies the kernel type to be used in the algorithm. If none is given, ‘rbf’ will be used. If a callable is given it is used to precompute the kernel matrix.
- degree: int, default=3
Degree of the polynomial kernel function (‘poly’). Must be non-negative. Ignored by all other kernels.
- gamma: {‘scale’, ‘auto’} or float, default=’scale’
Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’.
if
gamma='scale'
(default) is passed then it uses 1 / (n_features * X.var()) as value of gamma,if ‘auto’, uses 1 / n_features
if float, must be non-negative.
- coef0: float, default=0.0
Independent term in kernel function. It is only significant in ‘poly’ and ‘sigmoid’.
- shrinking: bool, default=True
Whether to use the shrinking heuristic. See the User Guide.
- probability: bool, default=False
Whether to enable probability estimates. This must be enabled prior to calling fit, will slow down that method as it internally uses 5-fold cross-validation, and predict_proba may be inconsistent with predict. Read more in the User Guide.
- tol: float, default=1e-3
Tolerance for stopping criterion.
- cache_size: float, default=200
Specify the size of the kernel cache (in MB).
- class_weight: {dict, ‘balanced’}, default=None
Set the parameter C of class i to class_weight[i]*C for SVC. If not given, all classes are supposed to have weight one. The “balanced” mode uses the values of y to automatically adjust weights inversely proportional to class frequencies as
n_samples / (n_classes * np.bincount(y))
.- verbose: bool, default=False
Enable verbose output. Note that this setting takes advantage of a per-process runtime setting in libsvm that, if enabled, may not work properly in a multithreaded context.
- max_iter: int, default=-1
Hard limit on iterations within solver, or -1 for no limit.
- decision_function_shape: {‘ovo’, ‘ovr’}, default=’ovr’
Whether to return a one-vs-rest (‘ovr’) decision function of shape (n_samples, n_classes) as all other classifiers, or the original one-vs-one (‘ovo’) decision function of libsvm which has shape (n_samples, n_classes * (n_classes - 1) / 2). However, one-vs-one (‘ovo’) is always used as multi-class strategy. The parameter is ignored for binary classification.
- break_ties: bool, default=False
If true,
decision_function_shape='ovr'
, and number of classes > 2, predict will break ties according to the confidence values of decision_function; otherwise the first class among the tied classes is returned. Please note that breaking ties comes at a relatively high computational cost compared to a simple predict.- random_state: int, RandomState instance or None, default=None
Controls the pseudo random number generation for shuffling the data for probability estimates. Ignored when probability is False. Pass an int for reproducible output across multiple function calls. See Glossary.
- input_cols: Optional[Union[str, List[str]]]
A string or list of strings representing column names that contain features. If this parameter is not specified, all columns in the input DataFrame except the columns specified by label_cols and sample-weight_col parameters are considered input columns.
- label_cols: Optional[Union[str, List[str]]]
A string or list of strings representing column names that contain labels. This is a required param for estimators, as there is no way to infer these columns. If this parameter is not specified, then object is fitted without labels(Like a transformer).
- output_cols: Optional[Union[str, List[str]]]
A string or list of strings representing column names that will store the output of predict and transform operations. The length of output_cols mus match the expected number of output columns from the specific estimator or transformer class used. If this parameter is not specified, output column names are derived by adding an OUTPUT_ prefix to the label column names. These inferred output column names work for estimator’s predict() method, but output_cols must be set explicitly for transformers.
- sample_weight_col: Optional[str]
A string representing the column name containing the examples’ weights. This argument is only required when working with weighted datasets.
- drop_input_cols: Optional[bool], default=False
If set, the response of predict(), transform() methods will not contain input columns.
Methods
decision_function
(dataset[, output_cols_prefix])Evaluate the decision function for the samples in X For more details on this function, see sklearn.svm.NuSVC.decision_function
fit
(dataset)Fit the SVM model according to the given training data For more details on this function, see sklearn.svm.NuSVC.fit
predict
(dataset)Perform classification on samples in X For more details on this function, see sklearn.svm.NuSVC.predict
predict_log_proba
(dataset[, output_cols_prefix])Compute probabilities of possible outcomes for samples in X For more details on this function, see sklearn.svm.NuSVC.predict_proba
predict_proba
(dataset[, output_cols_prefix])Compute probabilities of possible outcomes for samples in X For more details on this function, see sklearn.svm.NuSVC.predict_proba
score
(dataset)Return the mean accuracy on the given test data and labels For more details on this function, see sklearn.svm.NuSVC.score
set_input_cols
(input_cols)Input columns setter.
to_sklearn
()Get sklearn.svm.NuSVC object.
Attributes
model_signatures
Returns model signature of current class.