Fit SVC (RBF kernel)
C-Support Vector Classification. The implementation is based on libsvm. The fit time scales at least quadratically with the number of samples and may be impractical beyond tens of thousands of samples. The multiclass support is handled according to a one-vs-one scheme.
A Support Vector Machine (SVM) using a Radial Basis Function (RBF) kernel allows SVMs to handle non-linearly separable data by transforming it into a higher-dimensional space.
Usage:
Start the algorithm from the Processing Toolbox panel.
Select a training dataset or create one by clicking the processing algorithm icon, then click run.
Parameters
- Classifier [string]
Scikit-learn python code. See SVC, GridSearchCV, StandardScaler for information on different parameters. Default:
from sklearn.pipeline import make_pipeline from sklearn.model_selection import GridSearchCV from sklearn.preprocessing import StandardScaler from sklearn.svm import SVC svc = SVC\(probability=False\) param_grid = {'kernel': \['rbf'\], 'gamma': \[0.001, 0.01, 0.1, 1, 10, 100, 1000\], 'C': \[0.001, 0.01, 0.1, 1, 10, 100, 1000\]} tunedSVC = GridSearchCV\(cv=3, estimator=svc, scoring='f1_macro', param_grid=param_grid\) classifier = make_pipeline\(StandardScaler\(\), tunedSVC\)
- Training dataset [file]
Training dataset pickle file used for fitting the classifier. If not specified, an unfitted classifier is created.
Outputs
- Output classifier [fileDestination]
Pickle file destination.
Command-line usage
>qgis_process help enmapbox:FitSvcRbfKernel
:
----------------
Arguments
----------------
classifier: Classifier
Default value: from sklearn.pipeline import make_pipeline
from sklearn.model_selection import GridSearchCV
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
svc = SVC(probability=False)
param_grid = {'kernel': ['rbf'],
'gamma': [0.001, 0.01, 0.1, 1, 10, 100, 1000],
'C': [0.001, 0.01, 0.1, 1, 10, 100, 1000]}
tunedSVC = GridSearchCV(cv=3, estimator=svc, scoring='f1_macro', param_grid=param_grid)
classifier = make_pipeline(StandardScaler(), tunedSVC)
Argument type: string
Acceptable values:
- String value
- field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field
- expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression
dataset: Training dataset (optional)
Argument type: file
Acceptable values:
- Path to a file
outputClassifier: Output classifier
Argument type: fileDestination
Acceptable values:
- Path for new file
----------------
Outputs
----------------
outputClassifier: <outputFile>
Output classifier