cc.mallet.grmm.types
Class UniNormalFactor

java.lang.Object
  extended by cc.mallet.grmm.types.AbstractFactor
      extended by cc.mallet.grmm.types.UniNormalFactor
All Implemented Interfaces:
Factor, java.io.Serializable, java.lang.Cloneable

public class UniNormalFactor
extends AbstractFactor

Univariate Gaussian factor. $Id: UniNormalFactor.java,v 1.1 2007/10/22 21:37:44 mccallum Exp $

See Also:
Serialized Form

Field Summary
 
Fields inherited from class cc.mallet.grmm.types.AbstractFactor
vars
 
Constructor Summary
UniNormalFactor(Variable var, double mean, double variance)
           
 
Method Summary
 boolean almostEquals(Factor p, double epsilon)
           
 void divideBy(Factor f)
          Computes this /= pot
 java.lang.String dumpToString()
           
 Factor duplicate()
           
protected  Factor extractMaxInternal(VarSet varSet)
           
 boolean isNaN()
           
protected  double lookupValueInternal(int i)
           
protected  Factor marginalizeInternal(VarSet varsToKeep)
           
 void multiplyBy(Factor f)
          Does this *= pot.
 Factor normalize()
          Multiplies this potential by a constant such that it sums to 1.
 Assignment sample(Randoms r)
          Return an assignment sampled from this factor, interpreting it as an unnormalized probability distribution.
 Factor slice(Assignment assn)
           
 java.lang.String toString()
           
 double value(Assignment assn)
          Returns the value of the local function for a given assignment.
 
Methods inherited from class cc.mallet.grmm.types.AbstractFactor
almostEquals, argmax, assignmentIterator, asTable, containsVar, delogify, entropy, exponentiate, extractMax, extractMax, extractMax, getVariable, isInLogSpace, log, logify, logValue, logValue, logValue, marginalize, marginalize, marginalize, marginalizeOut, marginalizeOut, multiply, phi, prettyOutputString, setVarSet, sum, value, varSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UniNormalFactor

public UniNormalFactor(Variable var,
                       double mean,
                       double variance)
Method Detail

extractMaxInternal

protected Factor extractMaxInternal(VarSet varSet)
Specified by:
extractMaxInternal in class AbstractFactor

value

public double value(Assignment assn)
Description copied from interface: Factor
Returns the value of the local function for a given assignment. All variables in the potential must be included, but it's okay if the assignment uses variables not in the potential.

Specified by:
value in interface Factor
Overrides:
value in class AbstractFactor

lookupValueInternal

protected double lookupValueInternal(int i)
Specified by:
lookupValueInternal in class AbstractFactor

marginalizeInternal

protected Factor marginalizeInternal(VarSet varsToKeep)
Specified by:
marginalizeInternal in class AbstractFactor

normalize

public Factor normalize()
Description copied from interface: Factor
Multiplies this potential by a constant such that it sums to 1. Destructive; returns this factor.


sample

public Assignment sample(Randoms r)
Description copied from interface: Factor
Return an assignment sampled from this factor, interpreting it as an unnormalized probability distribution.

Specified by:
sample in interface Factor
Overrides:
sample in class AbstractFactor

almostEquals

public boolean almostEquals(Factor p,
                            double epsilon)

duplicate

public Factor duplicate()

isNaN

public boolean isNaN()

dumpToString

public java.lang.String dumpToString()

toString

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

slice

public Factor slice(Assignment assn)

multiplyBy

public void multiplyBy(Factor f)
Description copied from interface: Factor
Does this *= pot.

If both potentials are currently in log space, then does addition instead.

Specified by:
multiplyBy in interface Factor
Overrides:
multiplyBy in class AbstractFactor

divideBy

public void divideBy(Factor f)
Description copied from interface: Factor
Computes this /= pot

If both potentials are currently in log space, then does subtraction instead.

Specified by:
divideBy in interface Factor
Overrides:
divideBy in class AbstractFactor