Home > Mateda2.0 > learning > CreateMarkovModel.m

CreateMarkovModel

PURPOSE ^

[Cliques] = CreateMarkovModel(NumbVar,dim)

SYNOPSIS ^

function[Cliques] = CreateMarkovModel(NumbVar,dim)

DESCRIPTION ^

 [Cliques] = CreateMarkovModel(NumbVar,dim)  
 CreateMarkovModel:      Creates the structure of a Markov chain model where each variable
                         depends on its dim previous variables 
 INPUTS
 NumbVar: Number of variables
 dim: Number of previous variables each variables depends on 
 OUTPUTS
 Cliques: Structure of the model in a list of cliques that defines the (chain shaped)  junction tree. 
          Each row of Cliques is a clique. The first value is the number of overlapping variables. 
          The second, is the number of new variables.
          Then, overlapping variables are listed and  finally new variables are listed.

 Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function[Cliques] = CreateMarkovModel(NumbVar,dim)  
0002 % [Cliques] = CreateMarkovModel(NumbVar,dim)
0003 % CreateMarkovModel:      Creates the structure of a Markov chain model where each variable
0004 %                         depends on its dim previous variables
0005 % INPUTS
0006 % NumbVar: Number of variables
0007 % dim: Number of previous variables each variables depends on
0008 % OUTPUTS
0009 % Cliques: Structure of the model in a list of cliques that defines the (chain shaped)  junction tree.
0010 %          Each row of Cliques is a clique. The first value is the number of overlapping variables.
0011 %          The second, is the number of new variables.
0012 %          Then, overlapping variables are listed and  finally new variables are listed.
0013 %
0014 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
0015 
0016  
0017 if(dim==0)
0018  for i=1:NumbVar
0019   Cliques(i,1) = 0;
0020   Cliques(i,2) = 1;
0021   Cliques(i,3) = i;
0022  end
0023 else
0024   Cliques(1,1) = 0;
0025   Cliques(1,2) = dim;
0026   Cliques(1,3:dim+2) = 1:dim;
0027 
0028   for i=dim+1:NumbVar
0029     Cliques(i-dim+1,1) = dim;
0030     Cliques(i-dim+1,2) = 1;
0031     Cliques(i-dim+1,3:dim+2) = [i-dim:i-1];
0032     Cliques(i-dim+1,dim+3) = i;
0033   end
0034 
0035 end
0036 
0037 
0038 % Last version 9/26/2005. Roberto Santana (rsantana@si.ehu.es)

Generated on Fri 04-Dec-2009 13:38:29 by m2html © 2003