|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcc.mallet.grmm.types.AbstractFactor
cc.mallet.grmm.types.BinaryUnaryFactor
public class BinaryUnaryFactor
A factor over a continuous variable theta and binary variables var. such that phi(x|theta) is Potts. That is, for fixed theta, phi(x) = 1 if all x are equal, and exp^{-theta} otherwise. $Id: BinaryUnaryFactor.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 | |
|---|---|
BinaryUnaryFactor(Variable var,
Variable theta1,
Variable theta2)
|
|
| 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. |
Factor |
slice(Assignment assn)
|
double |
sumGradLog(Factor q,
Variable param,
Assignment paramAssn)
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 BinaryUnaryFactor(Variable var,
Variable theta1,
Variable theta2)
| Method Detail |
|---|
protected Factor extractMaxInternal(VarSet varSet)
extractMaxInternal in class AbstractFactorprotected double lookupValueInternal(int i)
lookupValueInternal in class AbstractFactorprotected Factor marginalizeInternal(VarSet varsToKeep)
marginalizeInternal in class AbstractFactorpublic double value(AssignmentIterator it)
FactorThis 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 Factorvalue in class AbstractFactorpublic Factor normalize()
Factor
normalize in interface Factorpublic Assignment sample(Randoms r)
Factor
sample in interface Factorsample in class AbstractFactorpublic double logValue(AssignmentIterator it)
logValue in interface FactorlogValue in class AbstractFactorpublic Factor slice(Assignment assn)
slice in interface Factorpublic java.lang.String dumpToString()
dumpToString in interface Factor
public double sumGradLog(Factor q,
Variable param,
Assignment paramAssn)
ParameterizedFactorsum_{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 ParameterizedFactorq - 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 Factor duplicate()
duplicate in interface Factor
public boolean almostEquals(Factor p,
double epsilon)
almostEquals in interface Factorpublic boolean isNaN()
isNaN in interface Factorpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||