|
||||||||||
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.Assignment
public class Assignment
An assignment to a bunch of variables.
Note that outcomes are always integers. If you want them to be something else, then the Variables all have outcome Alphabets; for example, seeVariable.lookupOutcome(int)
.
Created: Tue Oct 21 15:11:11 2003
Field Summary |
---|
Fields inherited from class cc.mallet.grmm.types.AbstractFactor |
---|
vars |
Constructor Summary | |
---|---|
Assignment()
Creates an empty assignment. |
|
Assignment(FactorGraph mdl,
int[] outcomes)
Creates an assignment over all Variables in a model. |
|
Assignment(java.util.List vars,
int[] outcomes)
Creates an assignemnt for the given variables. |
|
Assignment(Variable[] vars,
double[] outcomes)
Creates an assignemnt for the given variables. |
|
Assignment(Variable[] vars,
int[] outcomes)
Creates an assignemnt for the given variables. |
|
Assignment(Variable var,
double outcome)
|
|
Assignment(Variable var,
int outcome)
|
Method Summary | |
---|---|
void |
addRow(Assignment other)
|
void |
addRow(java.lang.Object[] row)
|
void |
addRow(Variable[] vars,
double[] values)
|
void |
addRow(Variable[] vars,
int[] values)
|
void |
addRow(Variable[] vars,
java.lang.Object[] values)
|
boolean |
almostEquals(Factor p,
double epsilon)
|
java.util.List |
asList()
Returns a list of single-row assignments, one for each row in this assignment. |
AbstractTableFactor |
asTable()
|
boolean |
containsVar(Variable var)
Returns true if this assignment specifies a value for var |
void |
dump()
|
void |
dump(java.io.PrintWriter out)
|
void |
dumpNumeric()
|
java.lang.String |
dumpToString()
|
Factor |
duplicate()
|
protected Factor |
extractMaxInternal(VarSet varSet)
|
int |
get(int ridx,
Variable var)
Returns the value of var in this assigment. |
int |
get(Variable var)
|
int[] |
getColumnInt(Variable x1)
|
double |
getDouble(int ridx,
Variable var)
Returns the value of var in this assigment. |
double |
getDouble(Variable var)
|
java.lang.Object |
getObject(int ri,
Variable var)
|
java.lang.Object |
getObject(Variable var)
|
Assignment |
getRow(int ridx)
|
Variable |
getVariable(int i)
|
Variable[] |
getVars()
Returns all variables which are assigned to. |
boolean |
isNaN()
|
protected double |
lookupValueInternal(int assnIdx)
|
static Assignment |
makeFromSingleIndex(VarSet clique,
int idx)
|
protected Factor |
marginalizeInternal(VarSet varsToKeep)
|
Factor |
normalize()
Multiplies this potential by a constant such that it sums to 1. |
int |
numRows()
|
int |
numVariables()
|
static Assignment |
restriction(Assignment assn,
VarSet varSet)
Deprecated. marginalize |
Assignment |
sample(Randoms r)
Return an assignment sampled from this factor, interpreting it as an unnormalized probability distribution. |
void |
setDouble(int ridx,
Variable var,
double value)
|
void |
setRow(int ridx,
Assignment other)
|
void |
setRow(int ridx,
int[] vals)
|
void |
setValue(int ridx,
Variable var,
int value)
|
void |
setValue(Variable var,
int value)
|
int |
singleIndex()
Converts this assignment into a unique integer. |
int |
singleIndex(int row)
|
int |
size()
|
Factor |
slice(Assignment assn)
|
Assignment |
subAssn(int start,
int end)
|
double[] |
toDoubleArray(int ridx)
|
static Assignment |
union(Assignment assn1,
Assignment assn2)
Returns the union of two Assignments. |
Methods inherited from class cc.mallet.grmm.types.AbstractFactor |
---|
almostEquals, argmax, assignmentIterator, delogify, divideBy, entropy, exponentiate, extractMax, extractMax, extractMax, isInLogSpace, log, logify, logValue, logValue, logValue, marginalize, marginalize, marginalize, marginalizeOut, marginalizeOut, multiply, multiplyBy, phi, prettyOutputString, setVarSet, sum, value, value, varSet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Assignment()
public Assignment(Variable var, int outcome)
public Assignment(Variable var, double outcome)
public Assignment(Variable[] vars, int[] outcomes)
public Assignment(Variable[] vars, double[] outcomes)
public Assignment(java.util.List vars, int[] outcomes)
public Assignment(FactorGraph mdl, int[] outcomes)
Method Detail |
---|
public static Assignment union(Assignment assn1, Assignment assn2)
If the assignments share variables, the value in the new Assignment for those variables in undefined.
assn1
- One assignment.assn2
- Another assignment.
public static Assignment restriction(Assignment assn, VarSet varSet)
assn
- A large assignmentvarSet
- Which variables to restrict assignment o
public Assignment getRow(int ridx)
public void addRow(Variable[] vars, int[] values)
public void addRow(Variable[] vars, double[] values)
public void addRow(Variable[] vars, java.lang.Object[] values)
public void addRow(java.lang.Object[] row)
public void addRow(Assignment other)
public int numRows()
public int get(Variable var)
public double getDouble(Variable var)
public java.lang.Object getObject(Variable var)
public int get(int ridx, Variable var)
public double getDouble(int ridx, Variable var)
public java.lang.Object getObject(int ri, Variable var)
public Variable getVariable(int i)
getVariable
in interface Factor
getVariable
in class AbstractFactor
public Variable[] getVars()
public int size()
public static Assignment makeFromSingleIndex(VarSet clique, int idx)
public int singleIndex()
public int singleIndex(int row)
public int numVariables()
public double[] toDoubleArray(int ridx)
public Factor duplicate()
duplicate
in interface Factor
public void dump()
public void dump(java.io.PrintWriter out)
public void dumpNumeric()
public boolean containsVar(Variable var)
containsVar
in interface Factor
containsVar
in class AbstractFactor
public void setValue(Variable var, int value)
public void setValue(int ridx, Variable var, int value)
public void setDouble(int ridx, Variable var, double value)
public void setRow(int ridx, Assignment other)
public void setRow(int ridx, int[] vals)
protected Factor extractMaxInternal(VarSet varSet)
extractMaxInternal
in class AbstractFactor
protected double lookupValueInternal(int assnIdx)
lookupValueInternal
in class AbstractFactor
protected Factor marginalizeInternal(VarSet varsToKeep)
marginalizeInternal
in class AbstractFactor
public boolean almostEquals(Factor p, double epsilon)
almostEquals
in interface Factor
public boolean isNaN()
isNaN
in interface Factor
public Factor normalize()
Factor
normalize
in interface Factor
public Assignment sample(Randoms r)
Factor
sample
in interface Factor
sample
in class AbstractFactor
public java.lang.String dumpToString()
dumpToString
in interface Factor
public Factor slice(Assignment assn)
slice
in interface Factor
public AbstractTableFactor asTable()
asTable
in interface Factor
asTable
in class AbstractFactor
public java.util.List asList()
public Assignment subAssn(int start, int end)
public int[] getColumnInt(Variable x1)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |