Fit LinearSVC
Linear Support Vector Classification. Similar to SVC with parameter kernel=’linear’, but implemented in terms of liblinear rather than libsvm, so it has more flexibility in the choice of penalties and loss functions and should scale better to large numbers of samples. This class supports both dense and sparse input and the multiclass support is handled according to a one-vs-the-rest scheme.
Parameters
- Classifier [string]
Scikit-learn python code. See LinearSVC, 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 LinearSVC svc = LinearSVC() param_grid = {'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:FitLinearsvc
:
----------------
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 LinearSVC
svc = LinearSVC()
param_grid = {'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
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