edu.washington.cs.supple.render.utility
Class FactoredCostFunctionState
java.lang.Object
edu.washington.cs.supple.render.utility.FactoredCostFunctionState
- All Implemented Interfaces:
- java.lang.Cloneable, java.io.Serializable
- public class FactoredCostFunctionState
- extends java.lang.Object
- implements java.io.Serializable, java.lang.Cloneable
- Author:
- kgajos
- See Also:
- Serialized Form
|
Method Summary |
void |
addNewSample()
|
java.lang.Object |
clone()
|
double[] |
computeExpectation()
|
double[][] |
getCovariance()
|
int |
getIndexFor(java.lang.String factorName)
|
double |
getNorm()
Returns the Euclidian norm of the current weight vector |
int |
getNumWeights()
|
double |
getVariance(int index)
|
double |
getVariance(java.lang.String factorName)
|
double |
getWeight(int index)
|
double |
getWeight(java.lang.String factorName)
|
double[] |
getWeights()
|
void |
setCovariance(double[][] covariance)
|
protected void |
setupLookupTable(FactoredCostFunction costFunction)
|
protected void |
setupLookupTable(int numFactors)
|
void |
setupSampleCollector(int numSamples)
|
protected void |
setupState(FactoredCostFunction costFunction,
int numEntries)
|
protected void |
setupState(FactoredCostFunction costFunction,
int numEntries,
double mean,
double stdev)
|
protected void |
setupState(int numFactors,
int numEntries,
double mean,
double stdev)
|
void |
setVariance(int index,
double variance)
|
void |
setVariance(java.lang.String factorName,
double variance)
|
void |
setWeight(int index,
double value)
|
void |
setWeight(java.lang.String factorName,
double value)
|
void |
setWeights(double[] weights)
|
java.lang.String |
stateToString()
|
java.lang.String |
toPrettyString()
|
java.util.Iterator |
weightNameIterator()
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
state
protected double[][] state
covariance
protected double[][] covariance
curEntryIndex
protected int curEntryIndex
namesToIndices
protected java.util.Hashtable namesToIndices
normCache
protected double normCache
FactoredCostFunctionState
public FactoredCostFunctionState(FactoredCostFunction costFunction)
FactoredCostFunctionState
public FactoredCostFunctionState(FactoredCostFunction costFunction,
double mean,
double stdev)
- Produces a uniform state for factors from a given cost functcion and with
a given mean and standard deviation for each weights
- Parameters:
costFunction - mean - stdev -
FactoredCostFunctionState
public FactoredCostFunctionState(int numFactors,
double mean,
double stdev)
- A constructor that produces a uniform dummy state with a specified number
of dimensions, mean and stdev for each dimension
- Parameters:
numFactors - mean - stdev -
setupState
protected void setupState(FactoredCostFunction costFunction,
int numEntries)
setupState
protected void setupState(FactoredCostFunction costFunction,
int numEntries,
double mean,
double stdev)
setupState
protected void setupState(int numFactors,
int numEntries,
double mean,
double stdev)
setupLookupTable
protected void setupLookupTable(FactoredCostFunction costFunction)
setupLookupTable
protected void setupLookupTable(int numFactors)
weightNameIterator
public java.util.Iterator weightNameIterator()
getIndexFor
public int getIndexFor(java.lang.String factorName)
getWeight
public double getWeight(int index)
getWeight
public double getWeight(java.lang.String factorName)
getWeights
public double[] getWeights()
setWeights
public void setWeights(double[] weights)
getNumWeights
public int getNumWeights()
setWeight
public void setWeight(int index,
double value)
setWeight
public void setWeight(java.lang.String factorName,
double value)
setVariance
public void setVariance(int index,
double variance)
setVariance
public void setVariance(java.lang.String factorName,
double variance)
getVariance
public double getVariance(int index)
getVariance
public double getVariance(java.lang.String factorName)
getCovariance
public double[][] getCovariance()
- Returns:
- Returns the covariance.
getNorm
public double getNorm()
- Returns the Euclidian norm of the current weight vector
- Returns:
computeExpectation
public double[] computeExpectation()
setCovariance
public void setCovariance(double[][] covariance)
- Parameters:
covariance - The covariance to set.
addNewSample
public void addNewSample()
setupSampleCollector
public void setupSampleCollector(int numSamples)
toPrettyString
public java.lang.String toPrettyString()
stateToString
public java.lang.String stateToString()
clone
public java.lang.Object clone()