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

ViewPCStruct

PURPOSE ^

[res_ordering] = ViewPCStruct(run_structures,viewparams)

SYNOPSIS ^

function[res_ordering] = ViewPCStruct(run_structures,viewparams)

DESCRIPTION ^

 [res_ordering] = ViewPCStruct(run_structures,viewparams)
 'ViewPCStruct':  Parallel coordinate visualization of the generations at which most
                  frequent edges appearing in the structures  learned by an EDA. The
                  vertical axis represents the generation at which edges (shown in the
                  horizontal axis) has been learned. A line between two points means that
                  both edges appear in the same structure learned at the same generation. 
 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} = fs; % fs: Font size for the images                       
 viewparams{2} : Matrices with edges that will be shown. One row for each
 edge. If viewparams{2}== [], the algorithm finds a subset of edges
 according viewparams{3}
 viewparams{3} = const_edg :  Minimal number of times that an edge has to appear in (all) the structures learned
                             to be selected for visualization. Since the  clarity of the parallel coordinate
                             visualization depend on the number of variables, this is an important parameter. 
 
 viewparams{4} = min_edg :  Minimal number of edges in the substructures selected (min_edg>0)
 viewparams{5} : Method used to order the variables before displaying them
 using  parallel coordinates. Ordering may help to reduce cluttering, improving
 visualization. viewparams{5} = 'none' if the current  given ordering is used. 
 viewparams{5} = 'random' for random order of variables 
 Ordering methods can be implemented by the user. Currently implemented is
 'ClusterUsingCorr' which clusters togethers variables with strong
 correlation using affinity propagation.
 viewparams{6} = distance. Distance used to cluster edges from their
 appearance in the structures (distances used by matlab command pdist (ex. 'correlation', 'euclidean',etc.) can
 be used (see help pdist).
 OUTPUT:
 res_ordering{1}: Generations from which the edges have been extracted
 res_ordering{2}: Executions from which the edges have been extracted
 res_ordering{3}: List of the edges

 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[res_ordering] = ViewPCStruct(run_structures,viewparams)
0002 % [res_ordering] = ViewPCStruct(run_structures,viewparams)
0003 % 'ViewPCStruct':  Parallel coordinate visualization of the generations at which most
0004 %                  frequent edges appearing in the structures  learned by an EDA. The
0005 %                  vertical axis represents the generation at which edges (shown in the
0006 %                  horizontal axis) has been learned. A line between two points means that
0007 %                  both edges appear in the same structure learned at the same generation.
0008 % INPUT:
0009 % run_structures: Contain the data structures with all the structures
0010 % learned by the probability models in every run and generation (see  program ReadStructures.m for details.
0011 % viewparams{1} = fs; % fs: Font size for the images
0012 % viewparams{2} : Matrices with edges that will be shown. One row for each
0013 % edge. If viewparams{2}== [], the algorithm finds a subset of edges
0014 % according viewparams{3}
0015 % viewparams{3} = const_edg :  Minimal number of times that an edge has to appear in (all) the structures learned
0016 %                             to be selected for visualization. Since the  clarity of the parallel coordinate
0017 %                             visualization depend on the number of variables, this is an important parameter.
0018 %
0019 % viewparams{4} = min_edg :  Minimal number of edges in the substructures selected (min_edg>0)
0020 % viewparams{5} : Method used to order the variables before displaying them
0021 % using  parallel coordinates. Ordering may help to reduce cluttering, improving
0022 % visualization. viewparams{5} = 'none' if the current  given ordering is used.
0023 % viewparams{5} = 'random' for random order of variables
0024 % Ordering methods can be implemented by the user. Currently implemented is
0025 % 'ClusterUsingCorr' which clusters togethers variables with strong
0026 % correlation using affinity propagation.
0027 % viewparams{6} = distance. Distance used to cluster edges from their
0028 % appearance in the structures (distances used by matlab command pdist (ex. 'correlation', 'euclidean',etc.) can
0029 % be used (see help pdist).
0030 % OUTPUT:
0031 % res_ordering{1}: Generations from which the edges have been extracted
0032 % res_ordering{2}: Executions from which the edges have been extracted
0033 % res_ordering{3}: List of the edges
0034 %
0035 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
0036 
0037 indexmatrix = run_structures{1};
0038 
0039 fs = viewparams{1};
0040 substruct = viewparams{2};
0041 const_edg = viewparams{3};
0042 min_edg = viewparams{4};
0043 edge_ordering_method = viewparams{5};
0044 distance =  viewparams{6};
0045 
0046 
0047 
0048 results{1} = [];
0049 
0050  if isempty(substruct)
0051    [RepEdges] = SelectEdgesToShow(run_structures,const_edg); % Edges are selected according to const_edg value
0052    if(isempty(RepEdges))
0053       disp('No edges were selected. Reduce the number of times required to an edge to appear.') %No edges were found
0054       return
0055    end
0056  else
0057   for i=1:size(substruct,1)  
0058    RepEdges(1,i) = indexmatrix(substruct(i,1),substruct(i,2));    % Indices of the edges in indexmatrix
0059   end
0060  end
0061  
0062  
0063  
0064  [AllRepVectors] = ExtractSubstructures(run_structures,RepEdges,min_edg); % The substructures to be shown are extracted
0065 
0066  nedges = size(RepEdges,2);
0067  ordering = [1:nedges];
0068  
0069  if(strcmp(edge_ordering_method,'random') == 1)
0070   ordering = randperm(nedges);   
0071  elseif(strcmp(edge_ordering_method,'none') ~= 1)    
0072      res_ordering  = eval([edge_ordering_method,'(AllRepVectors,distance)';]); %The method for ordering the variables is invoked
0073      ordering = res_ordering{1}; % The new ordering of the variables should be the first output of the method
0074  end,
0075 
0076  
0077  ShowParallelCoord(fs,AllRepVectors(:,ordering)); % Parallel coordinates are shown in the new ordering
0078   
0079  res_ordering{1} = ordering;
0080  
0081  for i=1:nedges
0082   [row,col] = find(indexmatrix==RepEdges(ordering(i)));
0083    res_ordering{3}(i,:) = [row(1),col(1)];
0084  end
0085  
0086  return
0087  
0088  
0089 
0090  
0091 
0092  
0093  
0094  
0095  
0096

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