List of all members.
Public Member Functions |
| CRFModel () |
| CRFModel (int imgWidth, int imgHeight, int MAPSTEPS) |
virtual int_int_vector | EstimateMAP (const double_double_vector Input) |
double | EstimateLogLikelihood (const double_double_vector &Input, const int_int_vector &Output) |
virtual void | EstimateModelParameters (const std::vector< double_double_vector > &InputSamples, const std::vector< int_int_vector > &OutputSamples, size_t Steps, double StepFactor) |
Protected Member Functions |
double | EvaluatePartitionFunction (const double_double_vector &Input) |
double_vector | EvaluateExpectedFeatureFunction (const double_double_vector &Input) |
double | EvaluateOutputEnergy (const double_double_vector &Input, const int_int_vector &Output) |
double | EvaluateNodeEnergy (const double_double_vector Input, const int_int_vector Output, size_t i, size_t j) |
double_vector | EvaluateNodeVector (const double_double_vector Input, const int_int_vector Output, size_t i, size_t j) |
int_vector | ConvertToNewNumberRepresentation (int number, int newRepresentationSymbolCount, int maxDigits) |
Protected Attributes |
double_vector | weights |
size_t | imageWidth |
size_t | imageHeight |
size_t | paramCount |
size_t | statesCount |
size_t | MAPSteps |
Constructor & Destructor Documentation
Constructor that initializes the configuration of the model. Width and Height are set to 1 pixel.
Constructor that initializes the configuration of the model.
- Parameters:
-
imgWidth | Image width in pixels. |
imgHeight | Image height in pixels. |
MAPSTEPS | Maximum number of steps to perform MAP estimation. |
Member Function Documentation
Converts an int (in the decimal numeral system, base-10) to an int [] (in any other numerical system, base-k). This function is used by EvaluatePartitionFunction and EvaluateExpectedFeatureFunction to loop through all the possible configurations.
- Parameters:
-
number | Number to be converted. |
newRepresentationSymbolCount | Number of distinct symbols in the new numeral system. |
maxDigits | The maxmimum number of digits. |
- Returns:
- An int_vector where each entry in the array corresponds to a seperate symbol in the new numeral system. The vector has size maxDigits.
Estimates the exact loglikelihood for a given input sample and output.
- Parameters:
-
Input | Input sample. |
Output | Output sample. |
- Returns:
- MAP solution.
Estimates the MAP (Maximum Aposterori Estimation) solution. By default, the Iterated Conditional Modes algorithm is used.
- Parameters:
-
- Returns:
- MAP solution.
Reimplemented in CRF::CRFModel_GraphCut.
void CRFModel::EstimateModelParameters |
( |
const std::vector< double_double_vector > & |
InputSamples, |
|
|
const std::vector< int_int_vector > & |
OutputSamples, |
|
|
size_t |
Steps, |
|
|
double |
StepFactor |
|
) |
| [virtual] |
Estimates the model parameters using steepest decent.
- Parameters:
-
InputSamples | Array of input samples. The format is InputSamples[i] = Input Sample i. |
OutputSamples | Array of correctly classified output samples. The format is OutputSamples[i] = Output Sample i. |
Steps | Number of steps to perform steepest decent before terminating. |
StepFactor | Factor determining the step length (in the direction of the loglikelihood gradient) of each iteration. Should be greater than zero and likely less than one. (The actual step length taken is multiplied by the preprocessor variable FeatureFunctionScaleDivision, which was divided by in the function EvaluateNodeVector to improve numerical accuracy on the partition function. This is just a computational practicality and will not affect any other calculations.). |
Reimplemented in CRF::CRFModel_CD.
Function used to estimate the exact partition function and the exact expected feature functions.
- Parameters:
-
- Returns:
- The partition function and the expected feature functions (under the models pdf). The forrmat is: Ret[0] = Partition Function, Ret[1] = expected feature function 0, ..., Ret[paramCount + 1] = value of expected feature function paramCount.
Estimates the energy at a specific node for a given input and output sample.
- Parameters:
-
Input | Input sample. |
Output | Output sample. |
- Returns:
- The energy for the specific node.
double_vector CRFModel::EvaluateNodeVector |
( |
const double_double_vector |
Input, |
|
|
const int_int_vector |
Output, |
|
|
size_t |
i, |
|
|
size_t |
j |
|
) |
| [protected] |
Estimates the vector for a given node. Summing these vectors for all the nodes and taking the inner product with the Weights will yield the energy for a given input and output sample. NOTICE: These values are divided by the preprocessor variable FeatureFunctionScaleDivision to improve numerical accuracy when doing calculations with the partition function.
- Parameters:
-
Input | Input sample. |
Output | Output sample. |
i | horizontal position of node. |
j | vertical position of node. |
- Returns:
- A node vector.
Estimates the energy function for a given input and output sample.
- Parameters:
-
Input | Input sample. |
Output | Output sample. |
- Returns:
- The energy function.
Function used to estimate the exact partition function.
- Parameters:
-
- Returns:
- The exact partition function.
Member Data Documentation
The image height. imageWidth times imageHeight equals the number nodes in the model. For exact inference should be <= 4. Otherwise the calculations become intractable.
The image width. imageWidth times imageHeight equals the number nodes in the model. For exact inference should be <= 4. Otherwise the calculations become intractable.
Number of maximum iterations for the Iterated Conditional Modes algorithm.
The number of weights (parameters). It has to equal the number of Weights (Weights.size()). Standard value: 5. (This is model specific so changes here will require changes in the source code.)
The number of states of each node. Standard value: 2 for black and white. (This is model specific so changes here will require changes in the source code.)
The parameters of the model. The format is Weights[k] equals the weight of feature function k.
The documentation for this class was generated from the following files: