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

# ClusterUsingCorr

## PURPOSE

[results] = ClusterUsingCorr(data,distance)

## SYNOPSIS

function[results] = ClusterUsingCorr(data,distance)

## DESCRIPTION

     [results] = ClusterUsingCorr(data,distance)

     ClusterUsingCorr:     Orders a set of features (or variables) according to their correlation
                           Strong correlated variables are intended to be clustered together
                           Affinity propagation is used to cluster the
                           features. Accordingly, the exemplars are also given as an output.
                           Ordering may help to reduce cluttering in parallel coordinates displaying, improving
                           visualization.
     INPUT
     data: A vector of data were rows are observations and columns are
     features
     OUTPUT
     results{1} =  A new ordering of the features, were subsequent features
     are suppossed to be more related
     results{2} =  Original clustering (idx) given by the affinity propagation
     algorithm

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

## CROSS-REFERENCE INFORMATION

This function calls:

- apcluster This program has been downloaded from

This function is called by:

## SOURCE CODE

    0001 function[results] = ClusterUsingCorr(data,distance)
    0002 % [results] = ClusterUsingCorr(data,distance)
    0003 %
    0004 % ClusterUsingCorr:     Orders a set of features (or variables) according to their correlation
    0005 %                       Strong correlated variables are intended to be clustered together
    0006 %                       Affinity propagation is used to cluster the
    0007 %                       features. Accordingly, the exemplars are also given as an output.
    0008 %                       Ordering may help to reduce cluttering in parallel coordinates displaying, improving
    0009 %                       visualization.
    0010 % INPUT
    0011 % data: A vector of data were rows are observations and columns are
    0012 % features
    0013 % OUTPUT
    0014 % results{1} =  A new ordering of the features, were subsequent features
    0015 % are suppossed to be more related
    0016 % results{2} =  Original clustering (idx) given by the affinity propagation
    0017 % algorithm
    0018 %
    0019 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
    0020
    0021 nedges = size(data,2)
    0022 y = pdist(data', distance);
    0023 rho = max(max(y)) - squareform(y); %Affinity propagation maximizes similarity = minimizes distance
    0024
    0025 s = mean(rho)     % The self-similarity measure is the mean of correlations for each variable
    0026
    0027 [idx,netsim,dpsim,expref]=apcluster(rho,s); % affinity propagation is done to identify clusters of correlated variables
    0028
    0029 [val,index] = sort(idx) % The variables are ordered according to their exemplar and the new ordering is output
    0030
    0031 results{1} = index';
    0032 results{2} = idx;
    0033
    0034 return