|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcc.mallet.grmm.types.CPT
public class CPT
$Id: CPT.java,v 1.1 2007/10/22 21:37:44 mccallum Exp $
| Constructor Summary | |
|---|---|
CPT(DiscreteFactor subFactor,
Variable child)
|
|
| Method Summary | |
|---|---|
boolean |
almostEquals(Factor p)
Returns whether this is almost equal to another potential. |
boolean |
almostEquals(Factor p,
double epsilon)
|
int |
argmax()
Returns the assignment that maximizes this potential. |
AssignmentIterator |
assignmentIterator()
Returns an iterator over all Assignmentss to this potential. |
AbstractTableFactor |
asTable()
|
boolean |
containsVar(Variable var)
Returns whether the potential is over the given variable. |
void |
divideBy(Factor pot)
Computes this /= pot |
java.lang.String |
dumpToString()
|
Factor |
duplicate()
|
double |
entropy()
Returns the expected log factor value, i.e., sum_x factor.value(x) * Math.log (factor.value (x)) where the summation is taken over all passible assignments. |
void |
exponentiate(double power)
|
Factor |
extractMax(java.util.Collection vars)
Returns a potential phi over the given variables obtained by taking phi (x) = max_[all v that contain x] this.prob (x) |
Factor |
extractMax(Variable var)
Returns a potential phi over the given variables obtained by taking phi (x) = max_[all v that contain x] this.prob (x) |
Factor |
extractMax(Variable[] vars)
Returns a potential phi over the given variables obtained by taking phi (x) = max_[all v that contain x] this.prob (x) |
Variable |
getChild()
|
VarSet |
getParents()
|
Variable |
getVariable(int i)
|
int |
indexAtLocation(int loc)
|
boolean |
isNaN()
|
double |
logValue(Assignment assn)
|
double |
logValue(AssignmentIterator it)
|
double |
logValue(int loc)
|
Factor |
marginalize(java.util.Collection vars)
Returns the marginal of this distribution over the given variables. |
Factor |
marginalize(Variable var)
Returns the marginal of this distribution over one variable. |
Factor |
marginalize(Variable[] vars)
Returns the marginal of this distribution over the given variables. |
Factor |
marginalizeOut(Variable var)
Returns the marginal distribution attained by summing out the given variable. |
Factor |
marginalizeOut(VarSet varset)
Returns the marginal distribution attained by summing out the given set of variables. |
Factor |
multiply(Factor dist)
Returns the elementwise product of this factor with another. |
void |
multiplyBy(Factor pot)
Does this *= pot. |
Factor |
normalize()
Multiplies this potential by a constant such that it sums to 1. |
int |
numLocations()
|
java.lang.String |
prettyOutputString()
|
Assignment |
sample(Randoms r)
Return an assignment sampled from this factor, interpreting it as an unnormalized probability distribution. |
int |
sampleLocation(Randoms r)
|
void |
setSubFactor(DiscreteFactor subFactor)
|
int |
singleIndex(int[] smallDims)
|
Factor |
slice(Assignment assn)
|
double |
sum()
Returns the sum of this potential over all cases. |
java.lang.String |
toString()
|
double[] |
toValueArray()
|
double |
value(Assignment assn)
Returns the value of the local function for a given assignment. |
double |
value(AssignmentIterator it)
Returns the probability of an assignment to these variables. |
double |
value(int index)
|
double |
valueAtLocation(int loc)
|
VarSet |
varSet()
Returns set of variables in this potential. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CPT(DiscreteFactor subFactor,
Variable child)
| Method Detail |
|---|
public VarSet getParents()
public Variable getChild()
public void setSubFactor(DiscreteFactor subFactor)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String prettyOutputString()
prettyOutputString in interface Factorpublic double value(Assignment assn)
Factor
value in interface Factorpublic 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 Factorpublic Factor normalize()
Factor
normalize in interface Factorpublic Factor marginalize(Variable[] vars)
Factor
marginalize in interface Factorpublic Factor marginalize(java.util.Collection vars)
Factor
marginalize in interface Factorpublic Factor marginalize(Variable var)
Factor
marginalize in interface Factorpublic Factor marginalizeOut(Variable var)
Factor
marginalizeOut in interface Factorpublic Factor extractMax(java.util.Collection vars)
Factor
extractMax in interface Factorpublic Factor extractMax(Variable var)
Factor
extractMax in interface Factorpublic Factor extractMax(Variable[] vars)
Factor
extractMax in interface Factorpublic int argmax()
Factor
argmax in interface Factorpublic Assignment sample(Randoms r)
Factor
sample in interface Factorpublic double sum()
Factor
sum in interface Factorpublic double entropy()
Factor
entropy in interface Factorpublic Factor multiply(Factor dist)
Factor
multiply in interface Factorpublic void multiplyBy(Factor pot)
FactorIf both potentials are currently in log space, then does addition instead.
multiplyBy in interface Factorpublic void exponentiate(double power)
exponentiate in interface Factorpublic void divideBy(Factor pot)
FactorIf both potentials are currently in log space, then does subtraction instead.
divideBy in interface Factorpublic boolean containsVar(Variable var)
Factor
containsVar in interface Factorpublic VarSet varSet()
Factor
varSet in interface Factorpublic AssignmentIterator assignmentIterator()
Factor
assignmentIterator in interface Factorpublic boolean almostEquals(Factor p)
Factor
almostEquals in interface Factor
public boolean almostEquals(Factor p,
double epsilon)
almostEquals in interface Factorpublic Factor duplicate()
duplicate in interface Factorpublic boolean isNaN()
isNaN in interface Factorpublic double logValue(AssignmentIterator it)
logValue in interface Factorpublic double logValue(Assignment assn)
logValue in interface Factorpublic double logValue(int loc)
logValue in interface Factorpublic Variable getVariable(int i)
getVariable in interface Factorpublic int sampleLocation(Randoms r)
sampleLocation in interface DiscreteFactorpublic double value(int index)
value in interface DiscreteFactorpublic int numLocations()
numLocations in interface DiscreteFactorpublic double valueAtLocation(int loc)
valueAtLocation in interface DiscreteFactorpublic int indexAtLocation(int loc)
indexAtLocation in interface DiscreteFactorpublic double[] toValueArray()
toValueArray in interface DiscreteFactorpublic int singleIndex(int[] smallDims)
singleIndex in interface DiscreteFactorpublic java.lang.String dumpToString()
dumpToString in interface Factorpublic Factor slice(Assignment assn)
slice in interface Factorpublic AbstractTableFactor asTable()
asTable in interface Factorpublic Factor marginalizeOut(VarSet varset)
Factor
marginalizeOut in interface Factor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||