Package mekano :: Package ml :: Module utils
[hide private]
[frames] | no frames]

Module utils

source code

Handy functions to produce scores and decisions for a list of documents.

For tuning thresholds, see Thresholder.

Functions [hide private]
 
scoreAll(classifier, docs)
Score all docs using a classifier.
source code
 
decideAll(classifier, docs, thresholds)
Makes decisions based on given thresholds for all docs using a multiclassifier.
source code
 
applyThresholds(scores, thresholds)
Apply thresholds to a label:score dictionary corresponding to a single doc.
source code
Variables [hide private]
  __package__ = None
Function Details [hide private]

scoreAll(classifier, docs)

source code 

Score all docs using a classifier.

Parameters:
  • classifier - A binary classifier
  • docs - A list of docs of type AtomVector
Returns:
A list of scores corresponding to the `docs`

decideAll(classifier, docs, thresholds)

source code 

Makes decisions based on given thresholds for all docs using a multiclassifier.

Parameters:
  • classifier - A MultiClassifier
  • docs - List of docs
  • thresholds - A label:float dictionary
Returns:
A list of sets of positive labels

applyThresholds(scores, thresholds)

source code 

Apply thresholds to a label:score dictionary corresponding to a single doc.

Parameters:
  • scores - A label:float dictionary of MultiClassifier-produced scores
  • thresholds - A label:float dictionary of thresholds
Returns:
A set of positive labels