alex.ml package¶
Submodules¶
alex.ml.exceptions module¶
- exception alex.ml.exceptions.FFNNException[source]¶
Bases: alex.AlexException
- exception alex.ml.exceptions.NBListException[source]¶
Bases: alex.AlexException
alex.ml.features module¶
alex.ml.ffnn module¶
alex.ml.hypothesis module¶
This module collects classes representing the uncertainty about the actual value of a base type instance.
- class alex.ml.hypothesis.ConfusionNetwork[source]¶
Bases: alex.ml.hypothesis.Hypothesis
Confusion network. In this representation, each fact breaks down into a sequence of elementary acts.
- add_merge(p, fact, combine=u'max')[source]¶
Add a fact and if it exists merge it according to the given combine strategy.
- classmethod from_fact(fact)[source]¶
Constructs a deterministic confusion network that asserts the given `fact’. Note that `fact’ has to be an iterable of elementary acts.
- merge(conf_net, combine=u'max')[source]¶
Merges facts in the current and the given confusion networks.
- Arguments:
- combine – can be one of {‘new’, ‘max’, ‘add’, ‘arit’, ‘harm’}, and
- determines how two probabilities should be merged (default: ‘max’)
XXX As of now, we know that different values for the same slot are contradictory (and in general, the set of contradicting attr-value pairs could be larger). We should therefore consider them alternatives to each other.
- class alex.ml.hypothesis.Hypothesis[source]¶
Bases: object
This is the base class for all forms of probabilistic hypotheses representations.
- class alex.ml.hypothesis.NBList[source]¶
Bases: alex.ml.hypothesis.Hypothesis
This class represents the uncertainty using an n-best list.
When updating an N-best list, one should do the following.
- add utterances or parse a confusion network
- merge and normalise, in either order
- add(probability, fact)[source]¶
Finds the last hypothesis with a lower probability and inserts the new item before that one. Optimised for adding objects from the highest probability ones to the lowest probability ones.