SklearnClassifier

class squirro.lib.nlp.steps.classifiers.SklearnClassifier(config)

Bases: squirro.lib.nlp.steps.classifiers.Classifier

Generic scikit-learn Classifier. See http://scikit-learn.org/stable/index.html.

Parameters
  • type (str) – sklearn

  • model_type (str) – Type of scikit learn model

  • model_kwargs (dict, {}) – Keyword arguments for scikit learn model

  • use_sparse (bool, False) – Whether or not to use a sparse input matrix

Methods Summary

load()

Load a step

process_batch(batch)

Process a batch of documents.

save()

Save a step

train(docs)

Train on a step of a set of documents

Methods Documentation

load()

Load a step

process_batch(batch)

Process a batch of documents. If not defined will default to using self.process_doc for each document in the batch.

Parameters

batch (list(Document)) – List of documents

Returns

List of processed documents

Return type

list(Document)

save()

Save a step

train(docs)

Train on a step of a set of documents

Parameters

docs (generator(Document)) – Generator of documents

Returns

Generator of processed documents

Return type

generator(Document)