marf.Stats
Class ProbabilityTable

java.lang.Object
  extended by marf.Stats.ProbabilityTable
All Implemented Interfaces:
java.io.Serializable

public class ProbabilityTable
extends java.lang.Object
implements java.io.Serializable

Probability Table. TODO: use marf.util.Matrix. $Id: ProbabilityTable.java,v 1.31 2005/07/30 20:05:45 mokhov Exp $

Since:
0.3.0.2
Version:
$Revision: 1.31 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Constructor Summary
ProbabilityTable(java.lang.String pstrLanguage)
          Constructor with the language parameter other than default.
 
Method Summary
 void dumpCSV()
          Allows dumping the contents of the table in the CSV format.
 java.lang.String getLang()
          Retrieves current language.
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 double getOccurence(int x)
          Allows getting an occurence given the x coordinate.
 double getOccurence(int x, int y)
          Allows getting an occurence given x and y coordinates.
 double getOccurence(int x, int y, int z)
          Allows getting an occurence given x, y, and z coordinates.
 double getOccurence(java.util.Vector poObservationList)
          Allows getting the occurence of a list of observations.
 int incFrequency(java.util.Vector poObservationList)
          Increments the frequency of occurences of a list of observations.
 boolean normalize()
          Not implemented.
 double P(Observation poObservationCause, Observation poObservationEffect)
          Not implemented.
 double P(Observation poObservationCause, java.util.Vector poObservationList)
          Not implemented.
 double P(java.util.Vector poObservationList)
          Retrieves the probability of a list of observations as a number of occurences.
 void setLang(java.lang.String pstrLang)
          Allows setting a natural language associated with this table.
 void setOccurence(int x, double pdOccurence)
          Allows setting an occurence given the x coordinate.
 void setOccurence(int x, int y, double pdOccurence)
          Allows setting an occurence given the x and y coordinates.
 void setOccurence(int x, int y, int z, double pdOccurence)
          Allows setting an occurence given the x, y, and z coordinates.
 void setOccurence(java.util.Vector poObservationList, double pdOccurence)
          Allows setting an occurence of a list of observations.
 int size()
          Retrieves the size of the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProbabilityTable

public ProbabilityTable(java.lang.String pstrLanguage)
Constructor with the language parameter other than default.

Parameters:
pstrLanguage - the language this table is for
See Also:
strLang
Method Detail

P

public final double P(Observation poObservationCause,
                      Observation poObservationEffect)
Not implemented.

Parameters:
poObservationCause - unused
poObservationEffect - unused
Returns:
0

P

public final double P(Observation poObservationCause,
                      java.util.Vector poObservationList)
Not implemented.

Parameters:
poObservationCause - unused
poObservationList - unused
Returns:
0

P

public final double P(java.util.Vector poObservationList)
Retrieves the probability of a list of observations as a number of occurences.

Parameters:
poObservationList -
Returns:
the probability

size

public final int size()
Retrieves the size of the table.

Returns:
the size (as the index size)

setOccurence

public final void setOccurence(int x,
                               double pdOccurence)
Allows setting an occurence given the x coordinate. An unigram model is assumed.

Parameters:
x -
pdOccurence -
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the coordinate is out of range

setOccurence

public final void setOccurence(int x,
                               int y,
                               double pdOccurence)
Allows setting an occurence given the x and y coordinates. A bigram model is assumed.

Parameters:
x -
y -
pdOccurence -
Throws:
java.lang.ArrayIndexOutOfBoundsException - if either of the coordinates is out of range

setOccurence

public final void setOccurence(int x,
                               int y,
                               int z,
                               double pdOccurence)
Allows setting an occurence given the x, y, and z coordinates. A trigram model is assumed.

Parameters:
x -
y -
z -
pdOccurence -
Throws:
java.lang.ArrayIndexOutOfBoundsException - if either of the coordinates is out of range

getOccurence

public final double getOccurence(int x)
Allows getting an occurence given the x coordinate. An unigram model is assumed.

Parameters:
x -
Returns:
the number of occurences of the item at the coordinates.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the coordinate is out of range

getOccurence

public final double getOccurence(int x,
                                 int y)
Allows getting an occurence given x and y coordinates. A bigram model is assumed.

Parameters:
x -
y -
Returns:
the number of occurences of the item at the coordinates.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if either of the coordinates is out of range

getOccurence

public final double getOccurence(int x,
                                 int y,
                                 int z)
Allows getting an occurence given x, y, and z coordinates. A trigram model is assumed.

Parameters:
x -
y -
z -
Returns:
the number of occurences of the item at the coordinates.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if either of the coordinates is out of range

setOccurence

public final void setOccurence(java.util.Vector poObservationList,
                               double pdOccurence)
Allows setting an occurence of a list of observations. Works with uni-, bi-, and trigram models.

Parameters:
poObservationList - the list
pdOccurence - the desired occurence

getOccurence

public final double getOccurence(java.util.Vector poObservationList)
Allows getting the occurence of a list of observations. Works with uni-, bi-, and trigram models.

Parameters:
poObservationList - the list
Returns:
the number of occurences

incFrequency

public final int incFrequency(java.util.Vector poObservationList)
Increments the frequency of occurences of a list of observations.

Parameters:
poObservationList - the list to work with
Returns:
the new frequency

normalize

public final boolean normalize()
Not implemented.

Returns:
false

dumpCSV

public void dumpCSV()
Allows dumping the contents of the table in the CSV format.


setLang

public final void setLang(java.lang.String pstrLang)
Allows setting a natural language associated with this table.

Parameters:
pstrLang - the language

getLang

public final java.lang.String getLang()
Retrieves current language.

Returns:
the associated natural language for this table

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Returns source code revision information.

Returns:
revision string