July 2017
Intermediate to advanced
382 pages
9h 13m
English
Alternatively, you can write your own classifier using the scikit-learn library.
You can do this by importing BaseEstimator and ClassifierMixin. The latter will provide a corresponding score method, which works for all classifiers. Optionally, you can overwrite the score method to provide your own:
In [1]: import numpy as np... from sklearn.base import BaseEstimator, ClassifierMixin
Then you can define a class that inherits from both BaseEstimator and ClassifierMixin:
In [2]: class MyClassifier(BaseEstimator, ClassifierMixin):... """An example classifier"""
You need to provide a constructor, a fit method, and a predict method. The constructor defines all parameters that the classifier ...
Read now
Unlock full access