Home > MRFLearning > CD.m

CD

PURPOSE ^

K-step Contrastive Divergence (CD) Learning

SYNOPSIS ^

function model = CD(data,A,K)

DESCRIPTION ^

 K-step Contrastive Divergence (CD) Learning

 Estimate the parameters for a boltzmann m/c using
 K-step Contrastive Divergence (CD) Learning
 INPUTS: 
        data      : (N X V) matrix where N = # data points and V = # variables
                     Each variable can take values from {+1,-1} or {0,1}                
        A         : Adjacency matrix defining the graph structure for the model to learn 
        K         : #steps of Markov chain
 RETURNS:
          model: (1X1) struct array with fields
                   N: the number of nodes
                   A: adjacency matrix                 
                   b: the biases  ( CD estimates )
                   w: the edge weights ( CD estimates )
           Optionally saves a file "paramVec.mat" showing the sequence of updates to the parameters  

 The node value representation ( +1/-1 or 0/1) intended by the user is guessed from the training samples.       
 If using 0/1, the data is first mapped to +1/-1 and the model params are learned. 
 These learned params are then mapped back to the 0/1 case.

 If the variable MONITOR is set to 1 on line <64>, a file "paramVec.mat" is generated that saves the parameter
 updates. One can plot these values to see if the gradient learning
 parmeters (MAX_ITERATIONS,ADAPT_PTS,EPSILON1,RHO_CHANGE,rho,rho_w,rho_b,momentum,batchsize) are reasonable. If not they can
 be changed on lines <55-63>

 Running of gradient ascent: one can chose the iterations (ADAPT_PTS) where the the global learning rate (rho) can be changed as given by (RHO_CHANGE). 
 Stops when either MAX_ITERATIONS is reached or maximum change across all
 parameters is less than EPSILON1. If required to have differnet learning
 rates for the biases and weights, we can set rho_b and rho_w different
 from 1. uses learning by minibatches with momentum

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Wed 28-Sep-2005 04:10:02 by m2html © 2003