Home > brede > brede_mat_hkmc.m



brede_mat_hkmc - K-means clustering


function [M1, M2] = brede_mat_hkmc(M, varargin)


 brede_mat_hkmc        - K-means clustering

       function [M1, M2] = brede_mat_hkmc(M, ...
           'PropertyName', 'PropertyValue')

       Input:    M    'Mat' input structure

       Property: Assignment      [ {left} | right ] Determines if the
                                 assignment matrix is the left of the
                                 right of the output arguments. 
                 Components      [ {10} | Integer>0 ] Number of clusters.
                 Info            [ {0} | Integer ] Amount of debug
                                 and progress information
                 Init            [ {ReverseLog} | Linear |
                                 UpperLinear | Random ] Initial
                                 cluster centers determination. The
                                 variables are sorted according to
                                 max of xcorr or std of variables and
                                 the initial centers are chosen from
                                 this list. 
                 MaxIterations   [ {Inf} | Integer ] Number of
                 Runs            [ {1} | Integer>0 ] Number of runs
                 Standardization [ {None} | Std | Range ] Determines
                                 the individual standardization
                                 (normalization) of the variables
                                 (the columns in the
                                 datamatrix. 'Std' will standardize
                                 with the standard deviation, 'Range'
                                 with the difference max-min 
                 Type            [ median | {mean} ]

       Output:   M1      'Mat' structure with assignment matrix if
                         'assignment' is 'left' else centroid matrix
                 M2      'Mat' structure with matrix containing
                         centers if 'assignment' is 'left' else the
                         assignment matrix.

       brede_mat_hkmc performs hierarchical K-means by iterating over
       the number of components. 

       'Assignment' determines whether the left matrix is containing
       the assigment matrix (labels, a matrix containing ones and
       zeros) or the centers.  

       'Init' determines how the cluster centers are initialized. For
       all types of 'init' K specific objects (eg, voxels) are
       selected (K corresponding to the number of clusters): For
       'random' the initial cluster centers are initialized by
       randomly picking K objects. For the other initialization
       methods the selection is deterministic from sorted
       objects. The sorting is either based on the standard deviation
       of the original data or the maximum of the cross-correlation
       function between the data and the paradigm. 'Linear' will
       select with linear space though the sorted list of objects,
       while 'reverselog' will select logarithmic through the list with
       the most cluster centers picked from the objects with the
       largest standard deviation or cross-correlation. 'UpperLinear'
       will select from the top of the list.

       'MaxIterations' is the maximum number of iterations of the
       clustering algorithm. The K-means algorithm always finish in a
       finite number of iterations and the algorithm will return when
       there is no more permutations among the cluster labels.

       'Runs' specifies the number of reruns of the entire
       algorithm. The K-means algorithm can converge to a local
       minimum and multiple runs is better to find the global
       minimum. For multiple runs the result from the run with the
       lowest error is returned.

       The individual variables (columns) in the datamatrix can be
       scaled according to 'Standardization': With 'Std' the columns
       are scaled to have equal standard deviation; with 'Range' the
       difference between minimum and maximum in each column is used
       to scale. Standardization should be used when the variables are
       measured with different units or the interesting features
       important for the discrimination lies in the variables with
       low magnitude. When the centers are found they are scaled back
       to the original space. 

       'Type' determines whether the clustering is K-means or

         [AA,CC] = brede_mat_hkmc(M);
         figure, brede_mat_plot_clusterbush(AA, CC);

                BREDE_MAT_NMF, BREDE_MAT_SVD.

 $Id: brede_mat_hkmc.m,v 1.7 2007/03/26 17:20:10 fn Exp $


This function calls: This function is called by:
Generated on Fri 27-Nov-2009 18:11:22 by m2html © 2005