|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.grmm.types.AbstractTableFactor cc.mallet.grmm.types.TableFactor
public class TableFactor
Created: Jan 4, 2006
Field Summary |
---|
Fields inherited from class cc.mallet.grmm.types.AbstractTableFactor |
---|
probs |
Constructor Summary | |
---|---|
TableFactor()
|
|
TableFactor(AbstractTableFactor in)
|
|
TableFactor(AbstractTableFactor ptl,
double[] probs)
|
|
TableFactor(BidirectionalIntObjectMap varMap)
|
|
TableFactor(java.util.Collection allVars)
|
|
TableFactor(Variable var)
|
|
TableFactor(Variable[] allVars)
|
|
TableFactor(Variable[] allVars,
double[] probs)
|
|
TableFactor(Variable[] allVars,
Matrix probsIn)
|
|
TableFactor(Variable var,
double[] values)
|
|
TableFactor(VarSet allVars,
double[] probs)
|
|
TableFactor(VarSet allVars,
Matrix probsIn)
|
Method Summary | |
---|---|
protected AbstractTableFactor |
createBlankSubset(Variable[] vars)
|
protected void |
divideByInternal(DiscreteFactor ptl)
|
Factor |
duplicate()
|
void |
exponentiate(double power)
|
Matrix |
getLogValueMatrix()
|
Matrix |
getValueMatrix()
|
double |
logValue(Assignment assn)
|
double |
logValue(AssignmentIterator it)
|
double |
logValue(int loc)
|
static TableFactor |
makeFromLogValues(VarSet domain,
double[] vals)
|
protected Factor |
marginalizeInternal(AbstractTableFactor result)
|
static AbstractTableFactor |
multiplyAll(java.util.Collection phis)
Returns the product of a collection of multinomial potentials. |
static DiscreteFactor |
multiplyAll(Factor[] phis)
|
protected void |
multiplyByInternal(DiscreteFactor ptl)
|
Factor |
normalize()
Multiplies every entry in the potential by a constant such that all the entries sum to 1. |
protected void |
plusEqualsAtLocation(int loc,
double v)
|
protected void |
plusEqualsInternal(DiscreteFactor ptl)
|
protected double |
rawValue(Assignment assn)
|
protected double |
rawValue(int singleIdx)
|
AbstractTableFactor |
recenter()
Multiplies this factor by the constant 1/max(). |
void |
setLogValue(Assignment assn,
double logValue)
Use of this method is discouraged. |
void |
setLogValue(AssignmentIterator assnIt,
double logValue)
Use of this method is discouraged. |
void |
setLogValues(double[] vals)
|
void |
setValue(AssignmentIterator assnIt,
double value)
Use of this method is discouraged. |
void |
setValues(double[] vals)
|
protected Factor |
slice_general(Variable[] vars,
Assignment observed)
|
protected Factor |
slice_onevar(Variable var,
Assignment observed)
Creates a new potential from another by restricting it to a given assignment. |
protected Factor |
slice_twovar(Variable v1,
Variable v2,
Assignment observed)
|
double |
sum()
Returns the sum of this potential over all cases. |
void |
timesEquals(double v)
Multiplies a constant by all values in the table. |
double |
value(Assignment assn)
Returns the value of the local function for a given assignment. |
double |
value(AssignmentIterator assn)
Returns the probability of an assignment to these variables. |
double |
value(int loc)
|
double |
valueAtLocation(int idx)
|
Methods inherited from class cc.mallet.grmm.types.AbstractTableFactor |
---|
almostEquals, almostEquals, argmax, assignmentIterator, asTable, clone, containsVar, divideBy, divideBy, dumpToString, ensureOperandCompatible, entropy, extractMax, extractMax, extractMax, findVariable, getNumVars, getValues, getVariable, indexAtLocation, isNaN, logsum, makeIdentityFactor, marginalize, marginalize, marginalize, marginalizeOut, marginalizeOut, multiply, multiplyBy, numLocations, plusEquals, plusEquals, prettyOutputString, printSizes, printValues, sample, sampleLocation, setRawValue, setRawValue, setRawValue, setValues, singleIndex, slice, toLogValueArray, toString, toValueArray, varSet |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TableFactor(Variable var)
public TableFactor(Variable var, double[] values)
public TableFactor()
public TableFactor(BidirectionalIntObjectMap varMap)
public TableFactor(Variable[] allVars)
public TableFactor(java.util.Collection allVars)
public TableFactor(Variable[] allVars, double[] probs)
public TableFactor(VarSet allVars, double[] probs)
public TableFactor(Variable[] allVars, Matrix probsIn)
public TableFactor(AbstractTableFactor in)
public TableFactor(VarSet allVars, Matrix probsIn)
public TableFactor(AbstractTableFactor ptl, double[] probs)
Method Detail |
---|
public static DiscreteFactor multiplyAll(Factor[] phis)
public static AbstractTableFactor multiplyAll(java.util.Collection phis)
public Factor duplicate()
duplicate
in interface Factor
duplicate
in class AbstractTableFactor
protected AbstractTableFactor createBlankSubset(Variable[] vars)
createBlankSubset
in class AbstractTableFactor
public Factor normalize()
normalize
in interface Factor
normalize
in class AbstractTableFactor
public double sum()
Factor
sum
in interface Factor
sum
in class AbstractTableFactor
public double logValue(AssignmentIterator it)
public double logValue(Assignment assn)
public double logValue(int loc)
public double value(Assignment assn)
Factor
value
in interface Factor
value
in class AbstractTableFactor
public double value(int loc)
public double value(AssignmentIterator assn)
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.
protected Factor marginalizeInternal(AbstractTableFactor result)
marginalizeInternal
in class AbstractTableFactor
protected void multiplyByInternal(DiscreteFactor ptl)
multiplyByInternal
in class AbstractTableFactor
protected void divideByInternal(DiscreteFactor ptl)
divideByInternal
in class AbstractTableFactor
protected void plusEqualsInternal(DiscreteFactor ptl)
plusEqualsInternal
in class AbstractTableFactor
protected double rawValue(Assignment assn)
protected double rawValue(int singleIdx)
rawValue
in class AbstractTableFactor
public void exponentiate(double power)
public void setLogValue(Assignment assn, double logValue)
AbstractTableFactor
setLogValue
in class AbstractTableFactor
public void setLogValue(AssignmentIterator assnIt, double logValue)
AbstractTableFactor
setLogValue
in class AbstractTableFactor
public void setValue(AssignmentIterator assnIt, double value)
AbstractTableFactor
setValue
in class AbstractTableFactor
public void setLogValues(double[] vals)
setLogValues
in class AbstractTableFactor
public void setValues(double[] vals)
setValues
in class AbstractTableFactor
public void timesEquals(double v)
AbstractTableFactor
timesEquals
in class AbstractTableFactor
protected void plusEqualsAtLocation(int loc, double v)
plusEqualsAtLocation
in class AbstractTableFactor
public Matrix getValueMatrix()
getValueMatrix
in class AbstractTableFactor
public Matrix getLogValueMatrix()
getLogValueMatrix
in class AbstractTableFactor
public double valueAtLocation(int idx)
protected Factor slice_onevar(Variable var, Assignment observed)
slice_onevar
in class AbstractTableFactor
var
- Variable the new potential will be overobserved
- Evidence to restrict to. Must give values for all variables in ptl.varSet() except for var.
protected Factor slice_twovar(Variable v1, Variable v2, Assignment observed)
slice_twovar
in class AbstractTableFactor
protected Factor slice_general(Variable[] vars, Assignment observed)
slice_general
in class AbstractTableFactor
public static TableFactor makeFromLogValues(VarSet domain, double[] vals)
public AbstractTableFactor recenter()
AbstractTableFactor
recenter
in class AbstractTableFactor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |