This module provides access to the LIBSVM solver.
Format feature vectors for use by LIBSVM.
| Parameters: | features_per_class (list of ndarray) – Per-class feature vectors. |
|---|---|
| Returns: | Labels and feature vectors. |
| Return type: | 2-tuple, where first element is a list and second element is a list of list |
Scale features to lie in a fixed interval.
Example Usage:
>>> instances = np.arange(10).reshape(2, 5)
>>> scaler = RangeFeatureScaler()
>>> scaler.Learn(instances)
>>> scaled_instances = scaler.Apply(instances)
See also
sklearn.preprocessing.Scaler
Scale the features in-place.
The range of output values will be (approximately) [-vmin, vmax], assuming the feature vectors passed here were drawn from the same distribution as those used to learn the scaling parameters.
| Parameters: | features (2D array-like) – Input data. |
|---|---|
| Returns: | Scaled feature values. |
| Return type: | 2D ndarray |
Determine the parameters required to scale each feature (independently) to the range [-1, 1].
| Parameters: | features (2D array-like) – Input data. |
|---|
A LIBSVM solver, which automatically scales feature values.
Test an existing classifier.
| Parameters: | features (3D array-like) – Test instances: indexed by class, instance, and then feature offset. |
|---|---|
| Returns: | Results from svmutil.svm_predict. |
| Return type: | dict |
Train an SVM classifier.
| Parameters: | features (3D array-like) – Training instances, indexed by class, instance, and then feature offset. |
|---|
Scale features to have fixed mean and standard deviation.
Example usage:
>>> instances = np.arange(10).reshape(2, 5)
>>> scaler = SpheringFeatureScaler()
>>> scaler.Learn(instances)
>>> scaled_instances = scaler.Apply(instances)
See also
sklearn.preprocessing.Scaler
Scale the features.
The range of output values will be (approximately) [-vmin, vmax], assuming the feature vectors passed here were drawn from the same distribution as those used to learn the scaling parameters.
| Parameters: | features (2D array-like) – Input data. |
|---|---|
| Returns: | Scaled features. |
| Return type: | 2D ndarray |
Determine the parameters required to scale each feature (independently) to the range [-1, 1].
| Parameters: | features (2D array-like) – Input data. |
|---|
The LIBSVM classifier.
See also
sklearn.svm.LinearSVC
Test an existing classifier.
| Parameters: | features (3D array-like) – Test instances: indexed by class, instance, and then feature offset. |
|---|---|
| Returns: | Results from svmutil.svm_predict. |
| Return type: | dict |
Train an SVM classifier.
| Parameters: | features (3D array-like) – Training instances, indexed by class, instance, and then by feature offset. |
|---|
Perform NxM way cross-validation.
| Parameters: |
|
|---|---|
| Returns: | Mean test accuracy across splits and repetitions. |
| Return type: | float |
Train and test an SVM classifier from a set of features.
Features should already have been partitioned into training and testing sets.
| Parameters: |
|
|---|---|
| Returns: | The trained classifier, the training accuracy, and the testing accuracy. |
| Return type: | 3-tuple, where first element is an SVM classifier, and the last two elements are floats |