Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cc.mallet.grmm.types
Class PottsTableFactor

    java.lang.Object
      cc.mallet.grmm.types.AbstractFactor
          cc.mallet.grmm.types.PottsTableFactor

All Implemented Interfaces:
  Factor, ParameterizedFactor, java.io.Serializable, java.lang.Cloneable

    public class PottsTableFactor

extends AbstractFactor
implements ParameterizedFactor

A factor over a continuous variable alpha and discrete variables `x` such that `phi(x|alpha)`is Potts. That is, for fixed alpha, `phi(x)` = 1 if all x are equal, and `exp^{-alpha}` otherwise. $Id: PottsTableFactor.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
`PottsTableFactor(Variable x1, Variable x2, Variable alpha)`
`PottsTableFactor(VarSet xs, Variable alpha)`

Method Summary
`boolean` | `almostEquals(Factor p, double epsilon)`
`java.lang.String` | `dumpToString()`
`Factor` | `duplicate()`
`boolean` | `equals(java.lang.Object o)`
`protected Factor` | `extractMaxInternal(VarSet varSet)`
`int` | `hashCode()`
`boolean` | `isNaN()`
`double` | `logValue(AssignmentIterator it)`
`protected double` | `lookupValueInternal(int i)`
`protected Factor` | `marginalizeInternal(VarSet varsToKeep)`
`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.
`double` | `secondDerivative(Factor q, Variable param, Assignment theta)`
`Factor` | `slice(Assignment assn)`
`double` | `sumGradLog(Factor q, Variable param, Assignment theta)` Computes the expected derivative of the log factor value.
`double` | `value(AssignmentIterator it)` Returns the probability of an assignment to these variables.

Methods inherited from class cc.mallet.grmm.types.AbstractFactor
`almostEquals, argmax, assignmentIterator, asTable, containsVar, delogify, divideBy, entropy, exponentiate, extractMax, extractMax, extractMax, getVariable, isInLogSpace, log, logify, logValue, logValue, marginalize, marginalize, marginalize, marginalizeOut, marginalizeOut, multiply, multiplyBy, phi, setVarSet, sum, value, varSet`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface cc.mallet.grmm.types.Factor
`almostEquals, argmax, assignmentIterator, asTable, containsVar, divideBy, entropy, exponentiate, extractMax, extractMax, extractMax, getVariable, logValue, logValue, marginalize, marginalize, marginalize, marginalizeOut, marginalizeOut, multiply, multiplyBy, sum, value, varSet`

Constructor Detail

### PottsTableFactor

    public PottsTableFactor(VarSet xs,
                            Variable alpha)

### PottsTableFactor

    public PottsTableFactor(Variable x1,
                            Variable x2,
                            Variable alpha)

Method Detail

### extractMaxInternal

    protected Factor extractMaxInternal(VarSet varSet)

  Specified by:
    `extractMaxInternal` 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`

### value

    public double value(AssignmentIterator it)

  Description copied from interface: `Factor`
  Returns the probability of an assignment to these variables. The assignment used is the curret assignment from the given AssignmentIterator.

  This can be used to do things like

               DiscretePotential phi = createMyPtl ();
               for (AssignmentIterator it = phi.assignmentIterator; it.hasNext(); it.advance()) {
                 double val = ptl.phi (it);
                       // do something with val
         }

  This is equivalent to creating an assignment object explicitly using `(Assignment) it.next()`, but can be much faster.

  Specified by:
    `value` in interface `Factor`
  Overrides:
    `value` 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.

  Specified by:
    `normalize` in interface `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`

### logValue

    public double logValue(AssignmentIterator it)

  Specified by:
    `logValue` in interface `Factor`
  Overrides:
    `logValue` in class `AbstractFactor`

### slice

    public Factor slice(Assignment assn)

  Specified by:
    `slice` in interface `Factor`

### dumpToString

    public java.lang.String dumpToString()

  Specified by:
    `dumpToString` in interface `Factor`

### sumGradLog

    public double sumGradLog(Factor q,
                             Variable param,
                             Assignment theta)

  Description copied from interface: `ParameterizedFactor`
  Computes the expected derivative of the log factor value. That is,

      sum_{y} q(y) dlog f(y) / d theta,
       where y are the outcomes of the discrete varables in the factor,
        f(y) is the factor value, and theta is the vector of continuous variables
        in the factor.  q is a user-specified distribution to take the expectation
        with respect to.

        The factor q specifies with variables to sum over.  The summation will be over
        all the variables in q.varSet(), and the rest of the variables will be used

  Specified by:
    `sumGradLog` in interface `ParameterizedFactor`
  Parameters:
    `q` - Distribution to take with respect to (need not be normalized). `q.varSet()` should be all of the variables of this factor, except for one continuous variable
    `param` - Parameter to take gradient with respect to.
  Returns:
    The expected gradient

### secondDerivative

    public double secondDerivative(Factor q,
                                   Variable param,
                                   Assignment theta)

### duplicate

    public Factor duplicate()

  Specified by:
    `duplicate` in interface `Factor`

### isNaN

    public boolean isNaN()

  Specified by:
    `isNaN` in interface `Factor`

### almostEquals

    public boolean almostEquals(Factor p,
                                double epsilon)

  Specified by:
    `almostEquals` in interface `Factor`

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD