Home > Mateda2.0 > knowledge_extraction > visualization > ViewEdgDepStruct.m

ViewEdgDepStruct

PURPOSE ^

[results] = ViewEdgDepStruct(run_structures,viewparams)

SYNOPSIS ^

function[results] = ViewEdgDepStruct(run_structures,viewparams)

DESCRIPTION ^

 [results] = ViewEdgDepStruct(run_structures,viewparams)
                       
 'ViewEdgDepStruct'  : Searches for substructures in the set of all the structures learned
                       and can show the adjacency matrices corresponding to
                       these  structures
 INPUT
 run_structures: Contain the data structures with all the structures
 learned by the probability models in every run and generation (see
 program ReadStructures.m for details.
 viewparams{1} = [pcolors,fs]; % pcolors: range of colors for the
 images. fs: Font size for the images
 viewparams{2}: Describe the substructure by giving values of
 absence/presence to a subset of edges. (see Example below)
 viewparams{3}:   % Vector with the selected runs  that will be inspected
 viewparams{4};  % Vector of with the selected generations  that will be inspected
 viewparams{5}; % Display type that could be one of the following:
   'all_graphs': There is an image for each structure that contain the
    substructure.
   'one_graph': an image adding all the structures that contain the
    substructure.
   'no_graph': no image is generated. This option is for the cases where we only
    want the list of runs and generations where the substructure is
    included. This is an output of the function (see ViewEdgDepStruct.m
    for details)
 OUTPUT
 results: a matrix of 2 columns, where each row contains a run and
 generation where the subgraph has been found 
 EXAMPLE
 We want to see all adjacency matrices of those structures learned in all runs
 such that edges (3,4) and (4,5) appear together and edge (3,5) does not appear
 viewparams{1} = [100,14];
 viewparams{2} = [3 4 1; 4 5 1; 3 5 0]; % The substructure is described
 viewparams{3} = [1:nruns]; % Selected runs (All)
 viewparams{4} = [1:maxgen]; % Selected generations (All)
 viewparams{5} = 'all_graphs'; % Graphs to be seen (All)
 [results] = ViewEdgDepStruct(run_structures,viewparams);

 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[results] = ViewEdgDepStruct(run_structures,viewparams)
0002 % [results] = ViewEdgDepStruct(run_structures,viewparams)
0003 %
0004 % 'ViewEdgDepStruct'  : Searches for substructures in the set of all the structures learned
0005 %                       and can show the adjacency matrices corresponding to
0006 %                       these  structures
0007 % INPUT
0008 % run_structures: Contain the data structures with all the structures
0009 % learned by the probability models in every run and generation (see
0010 % program ReadStructures.m for details.
0011 % viewparams{1} = [pcolors,fs]; % pcolors: range of colors for the
0012 % images. fs: Font size for the images
0013 % viewparams{2}: Describe the substructure by giving values of
0014 % absence/presence to a subset of edges. (see Example below)
0015 % viewparams{3}:   % Vector with the selected runs  that will be inspected
0016 % viewparams{4};  % Vector of with the selected generations  that will be inspected
0017 % viewparams{5}; % Display type that could be one of the following:
0018 %   'all_graphs': There is an image for each structure that contain the
0019 %    substructure.
0020 %   'one_graph': an image adding all the structures that contain the
0021 %    substructure.
0022 %   'no_graph': no image is generated. This option is for the cases where we only
0023 %    want the list of runs and generations where the substructure is
0024 %    included. This is an output of the function (see ViewEdgDepStruct.m
0025 %    for details)
0026 % OUTPUT
0027 % results: a matrix of 2 columns, where each row contains a run and
0028 % generation where the subgraph has been found
0029 % EXAMPLE
0030 % We want to see all adjacency matrices of those structures learned in all runs
0031 % such that edges (3,4) and (4,5) appear together and edge (3,5) does not appear
0032 % viewparams{1} = [100,14];
0033 % viewparams{2} = [3 4 1; 4 5 1; 3 5 0]; % The substructure is described
0034 % viewparams{3} = [1:nruns]; % Selected runs (All)
0035 % viewparams{4} = [1:maxgen]; % Selected generations (All)
0036 % viewparams{5} = 'all_graphs'; % Graphs to be seen (All)
0037 % [results] = ViewEdgDepStruct(run_structures,viewparams);
0038 %
0039 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
0040  
0041 
0042 indexmatrix = run_structures{1};
0043 AllBigMatrices = run_structures{2};
0044 
0045 pcolors = viewparams{1}(1); % Range of  colors
0046 fs = viewparams{1}(2);      % Fontsize for the figures
0047 
0048 substruct = viewparams{2};
0049 selected_runs = viewparams{3};
0050 generations = viewparams{4};
0051 display_type = viewparams{5};
0052 
0053 n = size(indexmatrix,1);
0054 AuxSumContactMatrix = zeros(n,n);
0055 results  = [];
0056 
0057 nconds = size(substruct,1);  % Number of conditions specified
0058 for i=1:nconds
0059  indexconds(i) = indexmatrix(substruct(i,1),substruct(i,2));    % Indices of the edges in indexmatrix
0060 end
0061  valconds = substruct(:,3);                                     % Values to be satisfied by the conditions
0062  
0063 a = 1; 
0064 for j=1:size(selected_runs,2)
0065     the_run = AllBigMatrices{selected_runs(j)} 
0066     for i=1:size(generations,2)        % Only generations specified in viewparams{3}
0067       one_gen = the_run(:,generations(i)); % Edges learned at that generation
0068       check_cond = sum(one_gen(indexconds)==valconds)==size(substruct,1); % Checking if all conditions are satisfied
0069      
0070       if(check_cond==1)       
0071          AuxContactMatrix = ConvertFromIndex(indexmatrix,one_gen);
0072          switch display_type
0073              case 'one_graph',  AuxSumContactMatrix = AuxSumContactMatrix +  AuxContactMatrix;
0074              case 'all_graphs', ShowImage(pcolors,fs,AuxContactMatrix);
0075          end;
0076          results(a,:) = [j,generations(i)]; %These are the runs and generations corresponding to the structures.
0077          a = a + 1; 
0078       end
0079     end    
0080 end  
0081   
0082 
0083   switch display_type
0084     case 'one_graph',  ShowImage(pcolors,fs,AuxSumContactMatrix);
0085   end;
0086 
0087 
0088 
0089

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