be.ac.ulg.montefiore.run.jahmm
Class OpdfInteger

java.lang.Object
  extended by be.ac.ulg.montefiore.run.jahmm.OpdfInteger
All Implemented Interfaces:
Opdf<ObservationInteger>, java.io.Serializable, java.lang.Cloneable

public class OpdfInteger
extends java.lang.Object
implements Opdf<ObservationInteger>

This class represents a distribution of a finite number of positive integer observations.

See Also:
Serialized Form

Constructor Summary
OpdfInteger(double[] probabilities)
          Builds a new probability distribution which operates on integer values.
OpdfInteger(int nbEntries)
          Builds a new probability distribution which operates on integer values.
 
Method Summary
 OpdfInteger clone()
           
 void fit(java.util.Collection<? extends ObservationInteger> co)
          Fits this observation probability (distribution) function to a (non empty) set of observations.
 void fit(java.util.Collection<? extends ObservationInteger> co, double[] weights)
          Fits this observation probability (distribution) function to a weighted (non empty) set of observations.
 void fit(ObservationInteger... oa)
          Fits this observation probability (distribution) function to a (non empty) set of observations.
 void fit(ObservationInteger[] o, double[] weights)
          Fits this observation probability (distribution) function to a weighted (non empty) set of observations.
 ObservationInteger generate()
          Generates a (pseudo) random observation according to this distribution.
 int nbEntries()
          Returns how many integers are associated to probabilities by this distribution.
 double probability(ObservationInteger o)
          Returns the probability (density) of an observation given a distribution.
 java.lang.String toString()
           
 java.lang.String toString(java.text.NumberFormat numberFormat)
          Returns a String describing this distribution.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OpdfInteger

public OpdfInteger(int nbEntries)
Builds a new probability distribution which operates on integer values. The probabilities are initialized so that the distribution is uniformaly distributed.

Parameters:
nbEntries - The number of values to which to associate probabilities. Observations handled by this distribution have to be higher or equal than 0 and strictly smaller than nbEntries.

OpdfInteger

public OpdfInteger(double[] probabilities)
Builds a new probability distribution which operates on integer values.

Parameters:
probabilities - Array holding one probability for each possible argument value (i.e. such that probabilities[i] is the probability of the observation i.
Method Detail

nbEntries

public int nbEntries()
Returns how many integers are associated to probabilities by this distribution.

Returns:
The number of integers are associated to probabilities.

probability

public double probability(ObservationInteger o)
Description copied from interface: Opdf
Returns the probability (density) of an observation given a distribution.

Specified by:
probability in interface Opdf<ObservationInteger>
Parameters:
o - An observation.
Returns:
The probability (density, if o takes continuous values) of o for this function.

generate

public ObservationInteger generate()
Description copied from interface: Opdf
Generates a (pseudo) random observation according to this distribution.

Specified by:
generate in interface Opdf<ObservationInteger>
Returns:
An observation.

fit

public void fit(ObservationInteger... oa)
Description copied from interface: Opdf
Fits this observation probability (distribution) function to a (non empty) set of observations. The meaning to give to fits should be has the maximum likelihood if possible.

Specified by:
fit in interface Opdf<ObservationInteger>
Parameters:
oa - An array of observations compatible with this function.

fit

public void fit(java.util.Collection<? extends ObservationInteger> co)
Description copied from interface: Opdf
Fits this observation probability (distribution) function to a (non empty) set of observations. The meaning to give to fits should be has the maximum likelihood if possible.

Specified by:
fit in interface Opdf<ObservationInteger>
Parameters:
co - A set of observations compatible with this function.

fit

public void fit(ObservationInteger[] o,
                double[] weights)
Description copied from interface: Opdf
Fits this observation probability (distribution) function to a weighted (non empty) set of observations. Equations (53) and (54) of Rabiner's A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition explain how the weights can be used.

Specified by:
fit in interface Opdf<ObservationInteger>
Parameters:
o - An array of observations compatible with this factory.
weights - The weight associated to each observation (such that weight.length == o.length and the sum of all the elements equals 1).

fit

public void fit(java.util.Collection<? extends ObservationInteger> co,
                double[] weights)
Description copied from interface: Opdf
Fits this observation probability (distribution) function to a weighted (non empty) set of observations. Equations (53) and (54) of Rabiner's A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition explain how the weights can be used.

Specified by:
fit in interface Opdf<ObservationInteger>
Parameters:
co - A set of observations compatible with this factory.
weights - The weight associated to each observation (such that weight.length == o.length and the sum of all the elements equals 1).

clone

public OpdfInteger clone()
Specified by:
clone in interface Opdf<ObservationInteger>
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.text.NumberFormat numberFormat)
Description copied from interface: Opdf
Returns a String describing this distribution.

Specified by:
toString in interface Opdf<ObservationInteger>
Parameters:
numberFormat - A formatter used to convert the numbers (e.g. probabilities) to strings.
Returns:
A String describing this distribution.


Copyright © 2004,2005 Jean-Marc François.