mc_scheme¶
In this module, multi-class schemes such as One-vs-One and One-vs-All are implemented.
Functions
mc_clf_no_params(bin_clfs) |
It calculates number of parameters for a multi-class model. |
Classes
OneVsAllClassifier(estimator) |
Multi-class classification using One-vs-One scheme |
OneVsOneClassifier(estimator) |
Multi-class classification using One-vs-One scheme |
-
class
mc_scheme.OneVsOneClassifier(estimator)[source]¶ Bases:
sklearn.base.BaseEstimator,sklearn.base.ClassifierMixinMulti-class classification using One-vs-One scheme
The
OneVsOneClassifieris scikit-learn compatible, which means scikit-learn tools such as cross_val_score and GridSearchCV can be used for an instance ofOneVsOneClassifierParameters: estimator : estimator object
An estimator object implementing fit and predict.
Attributes
clf_name (str) Name of the classifier. bin_clf_ (list) Stores intances of each binary TSVMclassifier.Methods
fit(X, y)It fits the OVO-classfier model according to the given training data. get_params([deep])Get parameters for this estimator. predict(X)Performs classification on samples in X using the OVO-classifier model. score(X, y[, sample_weight])Returns the mean accuracy on the given test data and labels. set_params(**params)Set the parameters of this estimator. -
fit(X, y)[source]¶ It fits the OVO-classfier model according to the given training data.
Parameters: X : array-like, shape (n_samples, n_features)
Training feature vectors, where n_samples is the number of samples and n_features is the number of features.
y : array-like, shape(n_samples,)
Target values or class labels.
Returns: self : object
-
-
class
mc_scheme.OneVsAllClassifier(estimator)[source]¶ Bases:
sklearn.base.BaseEstimator,sklearn.base.ClassifierMixinMulti-class classification using One-vs-One scheme
Parameters: estimator : estimator object
An estimator object implementing fit and predict.
Attributes
clf_name (str) Name of the classifier. bin_clf_ (list) Stores intances of each binary TSVMclassifier.Methods
fit(X, y)Parameters: get_params([deep])Get parameters for this estimator. predict(X)Performs classification on samples in X using the OVO-classifier model. score(X, y[, sample_weight])Returns the mean accuracy on the given test data and labels. set_params(**params)Set the parameters of this estimator.