Package Bio :: Module MaxEntropy
[show private | hide private]
[frames | no frames]

Module Bio.MaxEntropy

Maximum Entropy code.

Uses Improved Iterative Scaling: XXX ref

# XXX need to define terminology
Classes
MaxEntropy Holds information for a Maximum Entropy classifier.

Function Summary
  calculate(me, observation)
calculate(me, observation) -> list of log probs
  classify(me, observation)
classify(me, observation) -> class
  train(training_set, results, feature_fns, update_fn)
train(training_set, results, feature_fns[, update_fn]) -> MaxEntropy object

Function Details

calculate(me, observation)

calculate(me, observation) -> list of log probs

Calculate the log of the probability for each class. me is a MaxEntropy object that has been trained. observation is a vector representing the observed data. The return value is a list of unnormalized log probabilities for each class.

classify(me, observation)

classify(me, observation) -> class

Classify an observation into a class.

train(training_set, results, feature_fns, update_fn=None)

train(training_set, results, feature_fns[, update_fn]) -> MaxEntropy object

Train a maximum entropy classifier on a training set. training_set is a list of observations. results is a list of the class assignments for each observation. feature_fns is a list of the features. These are callback functions that take an observation and class and return a 1 or 0. update_fn is a callback function that's called at each training iteration. It is passed a MaxEntropy object that encapsulates the current state of the training.

Generated by Epydoc 2.1 on Thu Jun 30 22:05:35 2005 http://epydoc.sf.net