|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Factor
Interface for multivariate discrete probability distributions. All distributions are assumed to be over 0...k. If you want a distribution over some other discrete set, use the @see getAlphabet and @see setAlphabet members. (I thought about having a single Potential interface, for both continuous and discrete, but then all the method parameters were java.lang.Object, and the lack of type safety was both inefficient and disturbing.) Created: Mon Sep 15 14:04:58 2003
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 |
getVariable(int i)
|
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. |
java.lang.String |
prettyOutputString()
|
Assignment |
sample(Randoms r)
Return an assignment sampled from this factor, interpreting it as an unnormalized probability distribution. |
Factor |
slice(Assignment assn)
|
double |
sum()
Returns the sum of this potential over all cases. |
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. |
VarSet |
varSet()
Returns set of variables in this potential. |
Method Detail |
---|
double value(Assignment assn)
double value(AssignmentIterator it)
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.
Factor normalize()
Factor marginalize(Variable[] vars)
Factor marginalize(java.util.Collection vars)
Factor marginalize(Variable var)
Factor marginalizeOut(Variable var)
Factor marginalizeOut(VarSet varset)
Factor extractMax(java.util.Collection vars)
Factor extractMax(Variable var)
Factor extractMax(Variable[] vars)
int argmax()
Assignment sample(Randoms r)
double sum()
double entropy()
Factor multiply(Factor dist)
void multiplyBy(Factor pot)
If both potentials are currently in log space, then does addition instead.
java.lang.UnsupportedOperationException
- If one potential is in
log space and the other isn't.void exponentiate(double power)
void divideBy(Factor pot)
If both potentials are currently in log space, then does subtraction instead.
java.lang.UnsupportedOperationException
- If one potential is in
log space and the other isn't.boolean containsVar(Variable var)
VarSet varSet()
AssignmentIterator assignmentIterator()
boolean almostEquals(Factor p)
boolean almostEquals(Factor p, double epsilon)
Factor duplicate()
boolean isNaN()
double logValue(AssignmentIterator it)
double logValue(Assignment assn)
double logValue(int loc)
Variable getVariable(int i)
java.lang.String dumpToString()
java.lang.String prettyOutputString()
Factor slice(Assignment assn)
AbstractTableFactor asTable()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |