|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.grmm.types.AbstractFactor cc.mallet.grmm.types.PottsTableFactor
public class PottsTableFactor
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 $
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, prettyOutputString, 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, prettyOutputString, sum, value, varSet |
Constructor Detail |
---|
public PottsTableFactor(VarSet xs, Variable alpha)
public PottsTableFactor(Variable x1, Variable x2, Variable alpha)
Method Detail |
---|
protected Factor extractMaxInternal(VarSet varSet)
extractMaxInternal
in class AbstractFactor
protected double lookupValueInternal(int i)
lookupValueInternal
in class AbstractFactor
protected Factor marginalizeInternal(VarSet varsToKeep)
marginalizeInternal
in class AbstractFactor
public double value(AssignmentIterator it)
Factor
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.
value
in interface Factor
value
in class AbstractFactor
public Factor normalize()
Factor
normalize
in interface Factor
public Assignment sample(Randoms r)
Factor
sample
in interface Factor
sample
in class AbstractFactor
public double logValue(AssignmentIterator it)
logValue
in interface Factor
logValue
in class AbstractFactor
public Factor slice(Assignment assn)
slice
in interface Factor
public java.lang.String dumpToString()
dumpToString
in interface Factor
public double sumGradLog(Factor q, Variable param, Assignment theta)
ParameterizedFactor
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
sumGradLog
in interface ParameterizedFactor
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 variableparam
- Parameter to take gradient with respect to.
public double secondDerivative(Factor q, Variable param, Assignment theta)
public Factor duplicate()
duplicate
in interface Factor
public boolean isNaN()
isNaN
in interface Factor
public boolean almostEquals(Factor p, double epsilon)
almostEquals
in interface Factor
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |