Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

Random_Field Class Reference

A class representing an Conditional_MRF. More...

#include <Random_Field.hpp>

Inheritance diagram for Random_Field:

MRF External_Potts Generic_Potts Potts List of all members.

Public Member Functions

virtual ~Random_Field ()
 Destructor.
void Fix ()
 no parameter estimation
virtual uint Get_K ()
 Get the number of classess/colors ...
uint Get_N ()
 Get the number of sites.
virtual double H (uint i, uint k, vector< uint > const &Z)
 Hamiltonian.
virtual double Hmf (uint i, uint k)
 Mean-field hamiltonian, $ \tilde H $.
void Compute_PGmf (uint i, vector< double > &PG)
 Compute conditional probabilities given father class p and the neighbors Z. mean-field appoximation.
void Compute_PGmf (vector< double > &PG)
 Compute conditional probabilities given father class p and the neighbors Z. mean-field appoximation.
void Compute_PG (uint i, vector< uint > const &Z, vector< double > &PG)
 Compute class conditional probabilities at site i given upper class l and the neighbors Z.
void Simulate (vector< uint > &Z)
 Simulate the Block_MRF, one iteration. Gibbs sampler.
void Simulate (uint nbiter, vector< uint > &Z)
 Simulate the Block_MRF, Gibbs sampler.
void Set_Zmf (vector< double > const &z)
 Set the mean-field neighborhood, $ \tilde Z $.
void Set_Zmf (vector< double > const &z, uint i)
 Set the mean-field neighborhood at site $ i $.
void Get_Zmf (vector< double > &z)
 Get the mean-field neighborhood, $ \tilde Z $.
void Set_Z (vector< uint > const &z)
 Set neighborhood $ \tilde Z $.
virtual void Gradient (vector< double > const &tik, vector< double > &Q)
 Compute the gradient.
void Gradient (vector< uint > const &Z, vector< double > &Q)
 Compute the gradient.
virtual void Update_Gradient (vector< double > const &Q)
 Update model parameters in the gradient descent.
void Init_Gradient_Descent ()
 Initialize the gradient descent.
void Finalize_Gradient_Descent ()
 Finalize the gradient descent.
void Set_Gradient (double step, double tol, uint maxiter)
 Set gradient descent parameters.
void Update_Gradient_Step (vector< double > const &Qold, vector< double > const &Q)
 Update gradient step vector.
void Gradient_Descent (vector< double > const &tik)
 Perform the gradient descent.
virtual void Read_Params (istream &is)
 Read the model parameters from the stream is.
virtual void Write_Params (ostream &os)
 Write the model parameters to the stream os.
void Estimate (vector< double > const &tik)
 Estimate parameters given fuzzy classification.
void Estimate (vector< uint > const &Z)
 Estimate parameters given hard classification.
virtual uint Degrees_Of_Freedom ()
 Number of free parameters.
virtual void Info ()
 Print some info on the model.

Protected Member Functions

virtual void Precompute_Smf ()
 Precompute mean-field sums of Z (for the gradient algo.).

Protected Attributes

Neighborhood_SystemNHS
 Underlying neighborhood system.
vector< double > Z_mf
 Mean field neighborhood $ \tilde Z $.
vector< double > S_mf
 sums of all neighbors of a given class
bool precomputed_smf
 true if the sums have been precomputed.
bool fix
 true if Gamma has to be estimated.
double gradient_tol
 tolerence of the gradient algorithm. lower limit for gradient norm.
uint gradient_maxiter
 maximum number of iterations for the gradient algorithm.
vector< double > gradient_step
 step vector for gradient descent

Detailed Description

Author:
Juliette Blanchet
Date:
Dec. 2005
Generic Random Field model. Abstract.


Constructor & Destructor Documentation

Random_Field::~Random_Field  )  [virtual]
 

Destructor.


Member Function Documentation

void Random_Field::Compute_PG uint  i,
vector< uint > const &  Z,
vector< double > &  PG
 

Compute the conditional probabilities:

void Random_Field::Compute_PGmf uint  i,
vector< double > &  PG
 

Compute

$ P(Z_i = k | \tilde z, Y_i=p ) = \frac {Exp[ Hmf_ipk]} { \sum_h Exp [ Hmf_iph] } $

Parameters:
[out] PG : a vector containing all the probabilities.

void Random_Field::Estimate vector< uint > const &  Z  ) 
 

Estimate the parameters given the state $ Z $

Parameters:
[in] Z : current Random_Field state.

void Random_Field::Estimate vector< double > const &  tik  ) 
 

Estimate the parameters given the fuzzy classification $ t_ik $ .

Parameters:
[in] tik : fuzzy classification.
Performs a gradient descent to estimate model parameters.

uint Random_Field::Get_K  )  [virtual]
 

Get the total number of classes

Returns:
the total number of classes in the Random_Field.

Reimplemented in MRF.

uint Random_Field::Get_N  ) 
 

Get the number of sites.

Returns:
The number of sites.

void Random_Field::Gradient vector< uint > const &  Z,
vector< double > &  Q
 

Computes the gradient given current Random_Field state.

Parameters:
[in] Z : Random_Field state.
[out] Q : Gradient vector.

void Random_Field::Gradient vector< double > const &  tik,
vector< double > &  Q
[virtual]
 

Computes the gradient given the fuzzy classification.

Parameters:
[in] t : fuzzy classification.
[out] Q : Gradient vector.

Reimplemented in External_Potts, Generic_Potts, MRF, and Potts.

void Random_Field::Gradient_Descent vector< double > const &  tik  ) 
 

Performs a gradient descent to estimate model parameters.

Parameters:
[in] tik : fuzzy classification.

double Random_Field::H uint  i,
uint  k,
vector< uint > const &  z
[virtual]
 

Compute the Hamiltonian

Parameters:
i : a site.
k : a class.
z : current state.
Returns:
The value of the hamiltonian.
Abstract. Model-dependent.

Reimplemented in External_Potts, Generic_Potts, MRF, and Potts.

double Random_Field::Hmf uint  i,
uint  k
[virtual]
 

Compute the Hamiltonian mean-field approximation, given $ \tilde Z $

Parameters:
i : a site.
k : a class.
Returns:
The value of the approximate hamiltonian.
Abstract. Model-dependent.

Reimplemented in External_Potts, Generic_Potts, MRF, and Potts.

void Random_Field::Info  )  [virtual]
 

Print some info on the model.

Reimplemented in External_Potts, Generic_Potts, MRF, and Potts.

void Random_Field::Precompute_Smf  )  [protected, virtual]
 

Precompute S_mf_i= {j N_i} Zmf_{jk}, i, k This quantity does not change during the EM steps of the NR-EM algorithm.

Reimplemented in MRF.

void Random_Field::Read_Params istream &  is  )  [virtual]
 

Read the model parameters from the stream is.

Reimplemented in External_Potts, Generic_Potts, MRF, and Potts.

void Random_Field::Set_Z vector< uint > const &  z  ) 
 

Set the mean-field neighborhood, given Random_Field current state $ Z $ .

Parameters:
[in] z : current Random_Field state.
Define|Set neighborhod conditions.

void Random_Field::Set_Zmf vector< double > const &  z,
uint  i
 

Set the mean-field neighborhood, $ \tilde Z $ , at site i

Parameters:
[in] z : vector of doubles.
[in] i : a site.

void Random_Field::Set_Zmf vector< double > const &  z  ) 
 

Set the mean-field neighborhood, $ \tilde Z $

Parameters:
[in] z : vector of doubles.

void Random_Field::Simulate uint  nbiter,
vector< uint > &  Z
 

Simulation algorithm. Gibbs Sampler. N iterations over all the sites.

Parameters:
[in] nbiter : number of iterations.
[in] Z : current state.
[out] Z : new state

void Random_Field::Simulate vector< uint > &  Z  ) 
 

Simulation algorithm. Gibbs Sampler. 1 iteration over all the sites.

Parameters:
[in] Z : current state.
[out] Z : new state

void Random_Field::Write_Params ostream &  os  )  [virtual]
 

Write the model parameters to the stream os.

Reimplemented in External_Potts, Generic_Potts, MRF, and Potts.


The documentation for this class was generated from the following files:
Generated on Thu Jan 12 11:55:04 2006 for NEM by  doxygen 1.4.4