class documentation
class SklearnClassifier(ClassifierI): (source)
Constructor: SklearnClassifier(estimator, dtype, sparse)
Wrapper for scikit-learn classifiers.
Method | __init__ |
No summary |
Method | __repr__ |
Undocumented |
Method | classify |
Classify a batch of samples. |
Method | labels |
The class labels used by this classifier. |
Method | prob |
Compute per-class probabilities for a batch of samples. |
Method | train |
Train (fit) the scikit-learn estimator. |
Method | _make |
Undocumented |
Instance Variable | _clf |
Undocumented |
Instance Variable | _encoder |
Undocumented |
Instance Variable | _vectorizer |
Undocumented |
Inherited from ClassifierI
:
Method | classify |
No summary |
Method | prob |
No summary |
Parameters | |
estimator | scikit-learn classifier object. |
dtype | data type used when building feature array. scikit-learn estimators work exclusively on numeric data. The default value should be fine for almost all situations. |
sparse:boolean. | Whether to use sparse matrices internally. The estimator must support these; not all scikit-learn classifiers do (see their respective documentation and look for "sparse matrix"). The default value is True, since most NLP problems involve sparse feature sets. Setting this to False may take a great amount of memory. |
Classify a batch of samples.
Parameters | |
featuresets | An iterable over featuresets, each a dict mapping strings to either numbers, booleans or strings. |
Returns | |
list | The predicted class label for each input sample. |
overrides
nltk.classify.api.ClassifierI.labels
The class labels used by this classifier.
Returns | |
list | Undocumented |
Compute per-class probabilities for a batch of samples.
Parameters | |
featuresets | An iterable over featuresets, each a dict mapping strings to either numbers, booleans or strings. |
Returns | |
list of ProbDistI | Undocumented |