changeset 10729:e890606bd234 octave-forge

M inst/fcm.m M inst/xie_beni_index.m M inst/gustafson_kessel.m D inst/fcm_demo_1.m M inst/partition_entropy.m D inst/fcm_demo_2.m D inst/gustafson_kessel_demo_1.m D inst/gustafson_kessel_demo_2.m M inst/partition_coeff.m
author lmarkov
date Sun, 26 Aug 2012 14:54:12 +0000
parents e08c9a29b4e1
children a2187ff706f6
files main/fuzzy-logic-toolkit/inst/fcm.m main/fuzzy-logic-toolkit/inst/fcm_demo_1.m main/fuzzy-logic-toolkit/inst/fcm_demo_2.m main/fuzzy-logic-toolkit/inst/gustafson_kessel.m main/fuzzy-logic-toolkit/inst/gustafson_kessel_demo_1.m main/fuzzy-logic-toolkit/inst/gustafson_kessel_demo_2.m main/fuzzy-logic-toolkit/inst/partition_coeff.m main/fuzzy-logic-toolkit/inst/partition_entropy.m main/fuzzy-logic-toolkit/inst/xie_beni_index.m
diffstat 9 files changed, 477 insertions(+), 448 deletions(-) [+]
line wrap: on
line diff
--- a/main/fuzzy-logic-toolkit/inst/fcm.m	Sat Aug 25 08:27:39 2012 +0000
+++ b/main/fuzzy-logic-toolkit/inst/fcm.m	Sun Aug 26 14:54:12 2012 +0000
@@ -106,7 +106,7 @@
 ## @end group
 ## @end example
 ##
-## @seealso{fcm_demo_1, fcm_demo_2, gustafson_kessel, gustafson_kessel_demo_1, gustafson_kessel_demo_2, partition_coeff, partition_entropy, xie_beni_index}
+## @seealso{gustafson_kessel, partition_coeff, partition_entropy, xie_beni_index}
 ##
 ## @end deftypefn
 
@@ -114,7 +114,7 @@
 ## Keywords:      fuzzy-logic-toolkit fuzzy partition clustering fcm
 ## Directory:     fuzzy-logic-toolkit/inst/
 ## Filename:      fcm.m
-## Last-Modified: 19 Aug 2012
+## Last-Modified: 26 Aug 2012
 
 function [cluster_centers, soft_partition, obj_fcn_history] = ...
            fcm (input_data, num_clusters, options = [2.0, 100, 1e-5, 1])
@@ -212,3 +212,126 @@
   endif
 
 endfunction
+
+##----------------------------------------------------------------------
+## FCM Demo #1
+##----------------------------------------------------------------------
+
+%!demo
+%! ## This demo:
+%! ##    - classifies a small set of unlabeled data points using the
+%! ##      Fuzzy C-Means algorithm into two fuzzy clusters
+%! ##    - plots the input points together with the cluster centers
+%! ##
+%! ## Note: The input_data is taken from Chapter 13, Example 17 in
+%! ##       Fuzzy Logic: Intelligence, Control and Information, by
+%! ##       J. Yen and R. Langari, Prentice Hall, 1999, page 381
+%! ##       (International Edition). 
+%! 
+%! ## Use fcm to classify the input_data.
+%! input_data = [2 12; 4 9; 7 13; 11 5; 12 7; 14 4];
+%! number_of_clusters = 2;
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   fcm (input_data, number_of_clusters)
+%! 
+%! ## Plot the data points as small blue x's.
+%! figure ('NumberTitle', 'off', 'Name', 'FCM Demo 1');
+%! for i = 1 : rows (input_data)
+%!   plot (input_data(i, 1), input_data(i, 2), 'LineWidth', 2, ...
+%!         'marker', 'x', 'color', 'b');
+%!   hold on;
+%! endfor
+%! 
+%! ## Plot the cluster centers as larger red *'s.
+%! for i = 1 : number_of_clusters
+%!   plot (cluster_centers(i, 1), cluster_centers(i, 2), ...
+%!         'LineWidth', 4, 'marker', '*', 'color', 'r');
+%!   hold on;
+%! endfor
+%! 
+%! ## Make the figure look a little better:
+%! ##    - scale and label the axes
+%! ##    - show gridlines
+%! xlim ([0 15]);
+%! ylim ([0 15]);
+%! xlabel ('Feature 1');
+%! ylabel ('Feature 2');
+%! grid
+%! hold
+
+##----------------------------------------------------------------------
+## FCM Demo #2
+##----------------------------------------------------------------------
+
+%!demo
+%! ## This demo:
+%! ##    - classifies three-dimensional unlabeled data points using the
+%! ##      Fuzzy C-Means algorithm into three fuzzy clusters
+%! ##    - plots the input points together with the cluster centers
+%! ##
+%! ## Note: The input_data was selected to form three areas of
+%! ##       different shapes.
+%! 
+%! ## Use fcm to classify the input_data.
+%! input_data = [1 11 5; 1 12 6; 1 13 5; 2 11 7; 2 12 6; 2 13 7; 3 11 6;
+%!               3 12 5; 3 13 7;  1 1 10; 1 3 9; 2 2 11; 3 1 9; 3 3 10;
+%!               3 5 11; 4 4 9; 4 6 8; 5 5 8; 5 7 9; 6 6 10; 9 10 12;
+%!               9 12 13; 9 13 14; 10 9 13; 10 13 12; 11 10 14;
+%!               11 12 13; 12 6 12; 12 7 15; 12 9 15; 14 6 14; 14 8 13];
+%! number_of_clusters = 3;
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   fcm (input_data, number_of_clusters, [NaN NaN NaN 0])
+%! 
+%! ## Plot the data points in two dimensions (using features 1 & 2)
+%! ## as small blue x's.
+%! figure ('NumberTitle', 'off', 'Name', 'FCM Demo 2');
+%! for i = 1 : rows (input_data)
+%!   plot (input_data(i, 1), input_data(i, 2), 'LineWidth', 2, ...
+%!         'marker', 'x', 'color', 'b');
+%!   hold on;
+%! endfor
+%! 
+%! ## Plot the cluster centers in two dimensions (using features 1 & 2)
+%! ## as larger red *'s.
+%! for i = 1 : number_of_clusters
+%!   plot (cluster_centers(i, 1), cluster_centers(i, 2), ...
+%!         'LineWidth', 4, 'marker', '*', 'color', 'r');
+%!   hold on;
+%! endfor
+%! 
+%! ## Make the figure look a little better:
+%! ##    - scale and label the axes
+%! ##    - show gridlines
+%! xlim ([0 15]);
+%! ylim ([0 15]);
+%! xlabel ('Feature 1');
+%! ylabel ('Feature 2');
+%! grid
+%! hold
+%! 
+%! ## Plot the data points in two dimensions (using features 1 & 3)
+%! ## as small blue x's.
+%! figure ('NumberTitle', 'off', 'Name', 'FCM Demo 2');
+%! for i = 1 : rows (input_data)
+%!   plot (input_data(i, 1), input_data(i, 3), 'LineWidth', 2, ...
+%!         'marker', 'x', 'color', 'b');
+%!   hold on;
+%! endfor
+%! 
+%! ## Plot the cluster centers in two dimensions (using features 1 & 3)
+%! ## as larger red *'s.
+%! for i = 1 : number_of_clusters
+%!   plot (cluster_centers(i, 1), cluster_centers(i, 3), ...
+%!         'LineWidth', 4, 'marker', '*', 'color', 'r');
+%!   hold on;
+%! endfor
+%! 
+%! ## Make the figure look a little better:
+%! ##    - scale and label the axes
+%! ##    - show gridlines
+%! xlim ([0 15]);
+%! ylim ([0 15]);
+%! xlabel ('Feature 1');
+%! ylabel ('Feature 3');
+%! grid
+%! hold
--- a/main/fuzzy-logic-toolkit/inst/fcm_demo_1.m	Sat Aug 25 08:27:39 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-## Copyright (C) 2011-2012 L. Markowsky <lmarkov@users.sourceforge.net>
-##
-## This file is part of the fuzzy-logic-toolkit.
-##
-## The fuzzy-logic-toolkit is free software; you can redistribute it
-## and/or modify it under the terms of the GNU General Public License
-## as published by the Free Software Foundation; either version 3 of
-## the License, or (at your option) any later version.
-##
-## The fuzzy-logic-toolkit is distributed in the hope that it will be
-## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with the fuzzy-logic-toolkit; see the file COPYING.  If not,
-## see <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Script File} {} fcm_demo_1
-## Use the Fuzzy C-Means algorithm to classify a small set of unlabeled
-## data points and evaluate the quality of the resulting clusters.
-##
-## This demo:
-## @itemize @minus
-## @item
-## classifies a small set of unlabeled data points using the Fuzzy C-Means
-## algorithm into two fuzzy clusters
-## @item
-## calculates and prints (on standard output) three validity measures:
-## the partition coefficient, the partition entropy, and the Xie-Beni
-## validity index
-## @item
-## plots the input points together with the cluster centers
-## @end itemize
-##
-## For a description of the data structures used in the script, see the
-## documentation for fcm.
-##
-## @seealso{fcm, fcm_demo_2, partition_coeff, partition_entropy, xie_beni_index, gustafson_kessel, gustafson_kessel_demo_1, gustafson_kessel_demo_2}
-##
-## @end deftypefn
-
-## Author:        L. Markowsky
-## Keywords:      fuzzy-logic-toolkit fuzzy partition clustering fcm
-## Directory:     fuzzy-logic-toolkit/inst/
-## Filename:      fcm_demo_1.m
-## Last-Modified: 19 Aug 2012
-
-##----------------------------------------------------------------------
-## Note: The input_data is taken from Chapter 13, Example 17 in
-##       Fuzzy Logic: Intelligence, Control and Information, by J. Yen
-##       and R. Langari, Prentice Hall, 1999, page 381 (International
-##       Edition). 
-##----------------------------------------------------------------------
-
-## Use fcm to classify the data in matrix x.
-input_data = [2 12; 4 9; 7 13; 11 5; 12 7; 14 4]
-number_of_clusters = 2
-[cluster_centers, soft_partition, obj_fcn_history] = ...
-  fcm (input_data, number_of_clusters)
-
-## Calculate and print the three validity measures.
-printf ("Partition Coefficient: %f\n", ...
-        partition_coeff (soft_partition));
-printf ("Partition Entropy (with a = 2): %f\n", ...
-        partition_entropy (soft_partition, 2));
-printf ("Xie-Beni Index: %f\n\n", ...
-        xie_beni_index (input_data, cluster_centers, soft_partition));
- 
-## Plot the data points as small blue x's.
-figure ('NumberTitle', 'off', 'Name', 'FCM Demo 1');
-for i = 1 : rows (input_data)
-  plot (input_data(i, 1), input_data(i, 2), 'LineWidth', 2, ...
-        'marker', 'x', 'color', 'b');
-  hold on;
-endfor
-
-## Plot the cluster centers as larger red *'s.
-for i = 1 : number_of_clusters
-  plot (cluster_centers(i, 1), cluster_centers(i, 2), 'LineWidth', ...
-        4, 'marker', '*', 'color', 'r');
-  hold on;
-endfor
-
-## Make the figure look a little better:
-##   -- scale and label the axes
-##   -- show gridlines
-xlim ([0 15]);
-ylim ([0 15]);
-xlabel ('Feature 1');
-ylabel ('Feature 2');
-grid
-hold
--- a/main/fuzzy-logic-toolkit/inst/fcm_demo_2.m	Sat Aug 25 08:27:39 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-## Copyright (C) 2011-2012 L. Markowsky <lmarkov@users.sourceforge.net>
-##
-## This file is part of the fuzzy-logic-toolkit.
-##
-## The fuzzy-logic-toolkit is free software; you can redistribute it
-## and/or modify it under the terms of the GNU General Public License
-## as published by the Free Software Foundation; either version 3 of
-## the License, or (at your option) any later version.
-##
-## The fuzzy-logic-toolkit is distributed in the hope that it will be
-## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with the fuzzy-logic-toolkit; see the file COPYING.  If not,
-## see <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Script File} {} fcm_demo_2
-## Use the Fuzzy C-Means algorithm to classify three-dimensional unlabeled
-## data points and evaluate the quality of the resulting clusters.
-##
-## The demo:
-## @itemize @minus
-## @item
-## classifies three-dimensional unlabeled data points using the Fuzzy
-## C-Means algorithm into three fuzzy clusters
-## @item
-## calculates and prints (on standard output) three validity measures:
-## the partition coefficient, the partition entropy, and the Xie-Beni
-## validity index
-## @item
-## plots the input points together with the cluster centers
-## @end itemize
-##
-## For a description of the data structures used in the script, see the
-## documentation for fcm.
-##
-## @seealso{fcm, fcm_demo_1, partition_coeff, partition_entropy, xie_beni_index, gustafson_kessel, gustafson_kessel_demo_1, gustafson_kessel_demo_2}
-##
-## @end deftypefn
-
-## Author:        L. Markowsky
-## Keywords:      fuzzy-logic-toolkit fuzzy partition clustering fcm
-## Directory:     fuzzy-logic-toolkit/inst/
-## Filename:      fcm_demo_2.m
-## Last-Modified: 19 Aug 2012
-
-##----------------------------------------------------------------------
-## Note: The input_data was selected to form three areas of different
-##       shapes.
-##----------------------------------------------------------------------
-
-## Use fcm to classify the data in matrix x.
-input_data = [1 11 5; 1 12 6; 1 13 5; 2 11 7; 2 12 6; 2 13 7; 3 11 6;
-              3 12 5; 3 13 7;  1 1 10; 1 3 9; 2 2 11; 3 1 9; 3 3 10;
-              3 5 11; 4 4 9; 4 6 8; 5 5 8; 5 7 9; 6 6 10; 9 10 12;
-              9 12 13; 9 13 14; 10 9 13; 10 13 12; 11 10 14; 11 12 13;
-              12 6 12; 12 7 15; 12 9 15; 14 6 14; 14 8 13]
-number_of_clusters = 3
-[cluster_centers, soft_partition, obj_fcn_history] = ...
-  fcm (input_data, number_of_clusters, [NaN NaN NaN 0])
-
-## Calculate and print the three validity measures.
-printf ("Partition Coefficient: %f\n", ...
-        partition_coeff (soft_partition));
-printf ("Partition Entropy (with a = 2): %f\n", ...
-        partition_entropy (soft_partition, 2));
-printf ("Xie-Beni Index: %f\n\n", ...
-        xie_beni_index (input_data, cluster_centers, soft_partition));
- 
-## Plot the data points in two dimensions (using features 1 and 2)
-## as small blue x's.
-figure ('NumberTitle', 'off', 'Name', 'FCM Demo 2');
-for i = 1 : rows (input_data)
-  plot (input_data(i, 1), input_data(i, 2), 'LineWidth', 2, ...
-        'marker', 'x', 'color', 'b');
-  hold on;
-endfor
-
-## Plot the cluster centers in two dimensions (using features 1 and 2)
-## as larger red *'s.
-for i = 1 : number_of_clusters
-  plot (cluster_centers(i, 1), cluster_centers(i, 2), 'LineWidth', ...
-        4, 'marker', '*', 'color', 'r');
-  hold on;
-endfor
-
-## Make the figure look a little better:
-##   -- scale and label the axes
-##   -- show gridlines
-xlim ([0 15]);
-ylim ([0 15]);
-xlabel ('Feature 1');
-ylabel ('Feature 2');
-grid
-hold
-
-## Plot the data points in two dimensions (using features 1 and 3)
-## as small blue x's.
-figure ('NumberTitle', 'off', 'Name', 'FCM Demo 2');
-for i = 1 : rows (input_data)
-  plot (input_data(i, 1), input_data(i, 3), 'LineWidth', 2, ...
-        'marker', 'x', 'color', 'b');
-  hold on;
-endfor
-
-## Plot the cluster centers in two dimensions (using features 1 and 3)
-## as larger red *'s.
-for i = 1 : number_of_clusters
-  plot (cluster_centers(i, 1), cluster_centers(i, 3), 'LineWidth', ...
-        4, 'marker', '*', 'color', 'r');
-  hold on;
-endfor
-
-## Make the figure look a little better:
-##   -- scale and label the axes
-##   -- show gridlines
-xlim ([0 15]);
-ylim ([0 15]);
-xlabel ('Feature 1');
-ylabel ('Feature 3');
-grid
-hold
--- a/main/fuzzy-logic-toolkit/inst/gustafson_kessel.m	Sat Aug 25 08:27:39 2012 +0000
+++ b/main/fuzzy-logic-toolkit/inst/gustafson_kessel.m	Sun Aug 26 14:54:12 2012 +0000
@@ -111,7 +111,7 @@
 ## @end group
 ## @end example
 ##
-## @seealso{fcm, fcm_demo_1, fcm_demo_2, gustafson_kessel_demo_1, gustafson_kessel_demo_2, partition_coeff, partition_entropy, xie_beni_index}
+## @seealso{fcm, partition_coeff, partition_entropy, xie_beni_index}
 ##
 ## @end deftypefn
 
@@ -119,7 +119,7 @@
 ## Keywords:      fuzzy-logic-toolkit fuzzy partition clustering
 ## Directory:     fuzzy-logic-toolkit/inst/
 ## Filename:      gustafson_kessel.m
-## Last-Modified: 20 Aug 2012
+## Last-Modified: 26 Aug 2012
 
 function [cluster_centers, soft_partition, obj_fcn_history] = ...
            gustafson_kessel (input_data, num_clusters, ...
@@ -283,3 +283,125 @@
 
 endfunction
 
+##----------------------------------------------------------------------
+## Gustafson-Kessel Demo #1
+##----------------------------------------------------------------------
+
+%!demo
+%! ## This demo:
+%! ##    - classifies a small set of unlabeled data points using the
+%! ##      Gustafson-Kessel algorithm into two fuzzy clusters
+%! ##    - plots the input points together with the cluster centers
+%! ##
+%! ## Note: The input_data is taken from Chapter 13, Example 17 in
+%! ##       Fuzzy Logic: Intelligence, Control and Information, by
+%! ##       J. Yen and R. Langari, Prentice Hall, 1999, page 381
+%! ##       (International Edition). 
+%! 
+%! ## Use gustafson_kessel to classify the input_data.
+%! input_data = [2 12; 4 9; 7 13; 11 5; 12 7; 14 4];
+%! number_of_clusters = 2;
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   gustafson_kessel (input_data, number_of_clusters)
+%! 
+%! ## Plot the data points as small blue x's.
+%! figure ('NumberTitle', 'off', 'Name', 'Gustafson-Kessel Demo 1');
+%! for i = 1 : rows (input_data)
+%!   plot (input_data(i, 1), input_data(i, 2), 'LineWidth', 2, ...
+%!         'marker', 'x', 'color', 'b');
+%!   hold on;
+%! endfor
+%! 
+%! ## Plot the cluster centers as larger red *'s.
+%! for i = 1 : number_of_clusters
+%!   plot (cluster_centers(i, 1), cluster_centers(i, 2), 'LineWidth', ...
+%!         4, 'marker', '*', 'color', 'r');
+%!   hold on;
+%! endfor
+%! 
+%! ## Make the figure look a little better:
+%! ##    - scale and label the axes
+%! ##    - show gridlines
+%! xlim ([0 15]);
+%! ylim ([0 15]);
+%! xlabel ('Feature 1');
+%! ylabel ('Feature 2');
+%! grid
+%! hold
+
+##----------------------------------------------------------------------
+## Gustafson-Kessel Demo #2
+##----------------------------------------------------------------------
+
+%!demo
+%! ## This demo:
+%! ##    - classifies three-dimensional unlabeled data points using the
+%! ##      Gustafson-Kessel algorithm into three fuzzy clusters
+%! ##    - plots the input points together with the cluster centers
+%! ##
+%! ## Note: The input_data was selected to form three areas of
+%! ##       different shapes.
+%! 
+%! ## Use gustafson_kessel to classify the input_data.
+%! input_data = [1 11 5; 1 12 6; 1 13 5; 2 11 7; 2 12 6; 2 13 7; 3 11 6;
+%!               3 12 5; 3 13 7;  1 1 10; 1 3 9; 2 2 11; 3 1 9; 3 3 10;
+%!               3 5 11; 4 4 9; 4 6 8; 5 5 8; 5 7 9; 6 6 10; 9 10 12;
+%!               9 12 13; 9 13 14; 10 9 13; 10 13 12; 11 10 14;
+%!               11 12 13; 12 6 12; 12 7 15; 12 9 15; 14 6 14; 14 8 13];
+%! number_of_clusters = 3;
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   gustafson_kessel (input_data, number_of_clusters, [1 1 1], ...
+%!                     [NaN NaN NaN 0])
+%! 
+%! ## Plot the data points in two dimensions (using features 1 & 2)
+%! ## as small blue x's.
+%! figure ('NumberTitle', 'off', 'Name', 'Gustafson-Kessel Demo 2');
+%! for i = 1 : rows (input_data)
+%!   plot (input_data(i, 1), input_data(i, 2), 'LineWidth', 2, ...
+%!         'marker', 'x', 'color', 'b');
+%!   hold on;
+%! endfor
+%! 
+%! ## Plot the cluster centers in two dimensions (using features 1 & 2)
+%! ## as larger red *'s.
+%! for i = 1 : number_of_clusters
+%!   plot (cluster_centers(i, 1), cluster_centers(i, 2), 'LineWidth', ...
+%!         4, 'marker', '*', 'color', 'r');
+%!   hold on;
+%! endfor
+%! 
+%! ## Make the figure look a little better:
+%! ##    - scale and label the axes
+%! ##    - show gridlines
+%! xlim ([0 15]);
+%! ylim ([0 15]);
+%! xlabel ('Feature 1');
+%! ylabel ('Feature 2');
+%! grid
+%!  
+%! ## Plot the data points in two dimensions (using features 1 & 3)
+%! ## as small blue x's.
+%! figure ('NumberTitle', 'off', 'Name', 'Gustafson-Kessel Demo 2');
+%! for i = 1 : rows (input_data)
+%!   plot (input_data(i, 1), input_data(i, 3), 'LineWidth', 2, ...
+%!         'marker', 'x', 'color', 'b');
+%!   hold on;
+%! endfor
+%! 
+%! ## Plot the cluster centers in two dimensions (using features 1 & 3)
+%! ## as larger red *'s.
+%! for i = 1 : number_of_clusters
+%!   plot (cluster_centers(i, 1), cluster_centers(i, 3), 'LineWidth', ...
+%!         4, 'marker', '*', 'color', 'r');
+%!   hold on;
+%! endfor
+%! 
+%! ## Make the figure look a little better:
+%! ##    - scale and label the axes
+%! ##    - show gridlines
+%! xlim ([0 15]);
+%! ylim ([0 15]);
+%! xlabel ('Feature 1');
+%! ylabel ('Feature 3');
+%! grid
+%! hold
--- a/main/fuzzy-logic-toolkit/inst/gustafson_kessel_demo_1.m	Sat Aug 25 08:27:39 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-## Copyright (C) 2011-2012 L. Markowsky <lmarkov@users.sourceforge.net>
-##
-## This file is part of the fuzzy-logic-toolkit.
-##
-## The fuzzy-logic-toolkit is free software; you can redistribute it
-## and/or modify it under the terms of the GNU General Public License
-## as published by the Free Software Foundation; either version 3 of
-## the License, or (at your option) any later version.
-##
-## The fuzzy-logic-toolkit is distributed in the hope that it will be
-## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with the fuzzy-logic-toolkit; see the file COPYING.  If not,
-## see <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Script File} {} gustafson_kessel_demo_1
-## Use the Gustafson-Kessel algorithm to classify a small set of unlabeled
-## data points and evaluate the quality of the resulting clusters.
-##
-## The demo:
-## @itemize @minus
-## @item
-## classifies a small set of unlabeled data points using the Gustafson-Kessel
-## algorithm into two fuzzy clusters
-## @item
-## calculates and prints (on standard output) three validity measures:
-## the partition coefficient, the partition entropy, and the Xie-Beni
-## validity index
-## @item
-## plots the input points together with the cluster centers
-## @end itemize
-##
-## For a description of the data structures used in the script, see the
-## documentation for gustafson_kessel.
-##
-## @seealso{gustafson_kessel, gustafson_kessel_demo_2, partition_coeff, partition_entropy, xie_beni_index, fcm, fcm_demo_1, fcm_demo_2}
-##
-## @end deftypefn
-
-## Author:        L. Markowsky
-## Keywords:      fuzzy-logic-toolkit fuzzy partition clustering
-## Directory:     fuzzy-logic-toolkit/inst/
-## Filename:      gustafson_kessel_demo_1.m
-## Last-Modified: 20 Aug 2012
-
-##----------------------------------------------------------------------
-## Note: The input_data is taken from Chapter 13, Example 17 in
-##       Fuzzy Logic: Intelligence, Control and Information, by J. Yen
-##       and R. Langari, Prentice Hall, 1999, page 381 (International
-##       Edition). 
-##----------------------------------------------------------------------
-
-## Use gustafson_kessel to classify the data in matrix x.
-input_data = [2 12; 4 9; 7 13; 11 5; 12 7; 14 4]
-number_of_clusters = 2
-[cluster_centers, soft_partition, obj_fcn_history] = ...
-  gustafson_kessel (input_data, number_of_clusters)
-
-## Calculate and print the three validity measures.
-printf ("Partition Coefficient: %f\n", ...
-        partition_coeff (soft_partition));
-printf ("Partition Entropy (with a = 2): %f\n", ...
-        partition_entropy (soft_partition, 2));
-printf ("Xie-Beni Index: %f\n\n", ...
-        xie_beni_index (input_data, cluster_centers, soft_partition));
- 
-## Plot the data points as small blue x's.
-figure ('NumberTitle', 'off', 'Name', 'Gustafson-Kessel Demo 1');
-for i = 1 : rows (input_data)
-  plot (input_data(i, 1), input_data(i, 2), 'LineWidth', 2, ...
-        'marker', 'x', 'color', 'b');
-  hold on;
-endfor
-
-## Plot the cluster centers as larger red *'s.
-for i = 1 : number_of_clusters
-  plot (cluster_centers(i, 1), cluster_centers(i, 2), 'LineWidth', ...
-        4, 'marker', '*', 'color', 'r');
-  hold on;
-endfor
-
-## Make the figure look a little better:
-##   -- scale and label the axes
-##   -- show gridlines
-xlim ([0 15]);
-ylim ([0 15]);
-xlabel ('Feature 1');
-ylabel ('Feature 2');
-grid
-hold
--- a/main/fuzzy-logic-toolkit/inst/gustafson_kessel_demo_2.m	Sat Aug 25 08:27:39 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-## Copyright (C) 2011-2012 L. Markowsky <lmarkov@users.sourceforge.net>
-##
-## This file is part of the fuzzy-logic-toolkit.
-##
-## The fuzzy-logic-toolkit is free software; you can redistribute it
-## and/or modify it under the terms of the GNU General Public License
-## as published by the Free Software Foundation; either version 3 of
-## the License, or (at your option) any later version.
-##
-## The fuzzy-logic-toolkit is distributed in the hope that it will be
-## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with the fuzzy-logic-toolkit; see the file COPYING.  If not,
-## see <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Script File} {} gustafson_kessel_demo_2
-## Use the Gustafson-Kessel algorithm to classify three-dimensional unlabeled
-## data points and evaluate the quality of the resulting clusters.
-##
-## The demo:
-## @itemize @minus
-## @item
-## classifies three-dimensional unlabeled data points using the
-## Gustafson-Kessel algorithm into three fuzzy clusters
-## @item
-## calculates and prints (on standard output) three validity measures:
-## the partition coefficient, the partition entropy, and the Xie-Beni
-## validity index
-## @item
-## plots the input points together with the cluster centers
-## @end itemize
-##
-## For a description of the data structures used in the script, see the
-## documentation for gustafson_kessel.
-##
-## @seealso{gustafson_kessel, gustafson_kessel_demo_1, partition_coeff, partition_entropy, xie_beni_index, fcm, fcm_demo_1, fcm_demo_2}
-##
-## @end deftypefn
-
-## Author:        L. Markowsky
-## Keywords:      fuzzy-logic-toolkit fuzzy partition clustering
-## Directory:     fuzzy-logic-toolkit/inst/
-## Filename:      gustafson_kessel_demo_2.m
-## Last-Modified: 20 Aug 2012
-
-##----------------------------------------------------------------------
-## Note: The input_data was selected to form three areas of
-##       different shapes.
-##----------------------------------------------------------------------
-
-## Use gustafson_kessel to classify the data in matrix x.
-input_data = [1 11 5; 1 12 6; 1 13 5; 2 11 7; 2 12 6; 2 13 7; 3 11 6;
-              3 12 5; 3 13 7;  1 1 10; 1 3 9; 2 2 11; 3 1 9; 3 3 10;
-              3 5 11; 4 4 9; 4 6 8; 5 5 8; 5 7 9; 6 6 10; 9 10 12;
-              9 12 13; 9 13 14; 10 9 13; 10 13 12; 11 10 14; 11 12 13;
-              12 6 12; 12 7 15; 12 9 15; 14 6 14; 14 8 13]
-number_of_clusters = 3
-[cluster_centers, soft_partition, obj_fcn_history] = ...
-  gustafson_kessel (input_data, number_of_clusters, [1 1 1], ...
-                    [NaN NaN NaN 0])
-
-## Calculate and print the three validity measures.
-printf ("Partition Coefficient: %f\n", ...
-        partition_coeff (soft_partition));
-printf ("Partition Entropy (with a = 2): %f\n", ...
-        partition_entropy (soft_partition, 2));
-printf ("Xie-Beni Index: %f\n\n", ...
-        xie_beni_index (input_data, cluster_centers, soft_partition));
- 
-## Plot the data points in two dimensions (using features 1 and 2)
-## as small blue x's.
-figure ('NumberTitle', 'off', 'Name', 'Gustafson-Kessel Demo 2');
-for i = 1 : rows (input_data)
-  plot (input_data(i, 1), input_data(i, 2), 'LineWidth', 2, ...
-        'marker', 'x', 'color', 'b');
-  hold on;
-endfor
-
-## Plot the cluster centers in two dimensions (using features 1 and 2)
-## as larger red *'s.
-for i = 1 : number_of_clusters
-  plot (cluster_centers(i, 1), cluster_centers(i, 2), 'LineWidth', ...
-        4, 'marker', '*', 'color', 'r');
-  hold on;
-endfor
-
-## Make the figure look a little better:
-##   -- scale and label the axes
-##   -- show gridlines
-xlim ([0 15]);
-ylim ([0 15]);
-xlabel ('Feature 1');
-ylabel ('Feature 2');
-grid
- 
-## Plot the data points in two dimensions (using features 1 and 3)
-## as small blue x's.
-figure ('NumberTitle', 'off', 'Name', 'Gustafson-Kessel Demo 2');
-for i = 1 : rows (input_data)
-  plot (input_data(i, 1), input_data(i, 3), 'LineWidth', 2, ...
-        'marker', 'x', 'color', 'b');
-  hold on;
-endfor
-
-## Plot the cluster centers in two dimensions (using features 1 and 3)
-## as larger red *'s.
-for i = 1 : number_of_clusters
-  plot (cluster_centers(i, 1), cluster_centers(i, 3), 'LineWidth', ...
-        4, 'marker', '*', 'color', 'r');
-  hold on;
-endfor
-
-## Make the figure look a little better:
-##   -- scale and label the axes
-##   -- show gridlines
-xlim ([0 15]);
-ylim ([0 15]);
-xlabel ('Feature 1');
-ylabel ('Feature 3');
-grid
-hold
--- a/main/fuzzy-logic-toolkit/inst/partition_coeff.m	Sat Aug 25 08:27:39 2012 +0000
+++ b/main/fuzzy-logic-toolkit/inst/partition_coeff.m	Sun Aug 26 14:54:12 2012 +0000
@@ -36,7 +36,7 @@
 ## For more information about the @var{soft_partition} matrix, please see the
 ## documentation for function fcm.
 ##
-## @seealso{fcm, fcm_demo_1, fcm_demo_2, gustafson_kessel, gustafson_kessel_demo_1, gustafson_kessel_demo_2, partition_entropy, xie_beni_index}
+## @seealso{fcm, gustafson_kessel, partition_entropy, xie_beni_index}
 ##
 ## @end deftypefn
 
@@ -44,7 +44,7 @@
 ## Keywords:      fuzzy-logic-toolkit partition coefficient cluster
 ## Directory:     fuzzy-logic-toolkit/inst/
 ## Filename:      partition_coeff.m
-## Last-Modified: 19 Aug 2012
+## Last-Modified: 26 Aug 2012
 
 ##----------------------------------------------------------------------
 ## Note: This function is an implementation of Equation 13.9 (corrected
@@ -78,3 +78,77 @@
   vpc = (sum (sum (soft_part_sqr))) / columns (soft_partition);
 
 endfunction
+
+##----------------------------------------------------------------------
+## Partition Coefficient Demo #1
+##----------------------------------------------------------------------
+
+%!demo
+%! ## Use the Fuzzy C-Means and Gustafson-Kessel algorithms to classify
+%! ## a small set of unlabeled data points and evaluate the quality
+%! ## of the resulting clusters.
+%!
+%! ## Note: The input_data is taken from Chapter 13, Example 17 in
+%! ##       Fuzzy Logic: Intelligence, Control and Information, by
+%! ##       J. Yen and R. Langari, Prentice Hall, 1999, page 381
+%! ##       (International Edition). 
+%! 
+%! input_data = [2 12; 4 9; 7 13; 11 5; 12 7; 14 4]
+%! number_of_clusters = 2
+%! 
+%! ## Using fcm, classify the input data, print the cluster centers,
+%! ## and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   fcm (input_data, number_of_clusters, [NaN NaN NaN 0]);
+%! puts ("\nResults using the Fuzzy C-Means algorithm:\n\n");
+%! cluster_centers
+%! printf ("partition coefficient: %f\n", ...
+%!         partition_coeff (soft_partition));
+%! 
+%! ## Using gustafson_kessel, classify the input data, print the cluster
+%! ## centers, and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   gustafson_kessel (input_data, number_of_clusters, [1 1 1], ...
+%!                     [NaN NaN NaN 0]);
+%! puts ("\nResults using the Gustafson-Kessel algorithm:\n\n");
+%! cluster_centers
+%! printf ("partition coefficient: %f\n\n", ...
+%!         partition_coeff (soft_partition));
+
+##----------------------------------------------------------------------
+## Partition Coefficient Demo #2
+##----------------------------------------------------------------------
+
+%!demo
+%! ## Use the Fuzzy C-Means and Gustafson-Kessel algorithms to classify
+%! ## three-dimensional unlabeled data points and evaluate the quality
+%! ## of the resulting clusters.
+%!
+%! ## Note: The input_data was selected to form three areas of
+%! ##       different shapes.
+%!
+%! input_data = [1 11 5; 1 12 6; 1 13 5; 2 11 7; 2 12 6; 2 13 7; 3 11 6;
+%!               3 12 5; 3 13 7;  1 1 10; 1 3 9; 2 2 11; 3 1 9; 3 3 10;
+%!               3 5 11; 4 4 9; 4 6 8; 5 5 8; 5 7 9; 6 6 10; 9 10 12;
+%!               9 12 13; 9 13 14; 10 9 13; 10 13 12; 11 10 14;
+%!               11 12 13; 12 6 12; 12 7 15; 12 9 15; 14 6 14; 14 8 13]
+%! number_of_clusters = 3
+%!
+%! ## Using fcm, classify the input data, print the cluster centers,
+%! ## and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   fcm (input_data, number_of_clusters, [NaN NaN NaN 0]);
+%! puts ("\nResults using the Fuzzy C-Means algorithm:\n\n");
+%! cluster_centers
+%! printf ("partition coefficient: %f\n", ...
+%!         partition_coeff (soft_partition));
+%! 
+%! ## Using gustafson_kessel, classify the input data, print the cluster
+%! ## centers, and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   gustafson_kessel (input_data, number_of_clusters, [1 1 1], ...
+%!                     [NaN NaN NaN 0]);
+%! puts ("\nResults using the Gustafson-Kessel algorithm:\n\n");
+%! cluster_centers
+%! printf ("partition coefficient: %f\n\n", ...
+%!         partition_coeff (soft_partition));
--- a/main/fuzzy-logic-toolkit/inst/partition_entropy.m	Sat Aug 25 08:27:39 2012 +0000
+++ b/main/fuzzy-logic-toolkit/inst/partition_entropy.m	Sun Aug 26 14:54:12 2012 +0000
@@ -38,7 +38,7 @@
 ## For more information about the @var{soft_partition} matrix, please see the
 ## documentation for function fcm.
 ##
-## @seealso{fcm, fcm_demo_1, fcm_demo_2, gustafson_kessel, gustafson_kessel_demo_1, gustafson_kessel_demo_2, partition_coeff, xie_beni_index}
+## @seealso{fcm, gustafson_kessel, partition_coeff, xie_beni_index}
 ##
 ## @end deftypefn
 
@@ -46,7 +46,7 @@
 ## Keywords:      fuzzy-logic-toolkit partition entropy cluster
 ## Directory:     fuzzy-logic-toolkit/inst/
 ## Filename:      partition_entropy.m
-## Last-Modified: 19 Aug 2012
+## Last-Modified: 26 Aug 2012
 
 ##----------------------------------------------------------------------
 ## Note: This function is an implementation of Equation 13.10 in
@@ -86,3 +86,77 @@
   vpe = -(sum (sum (Mu .* log_a_Mu))) / n;
 
 endfunction
+
+##----------------------------------------------------------------------
+## Partition Entropy Demo #1
+##----------------------------------------------------------------------
+
+%!demo
+%! ## Use the Fuzzy C-Means and Gustafson-Kessel algorithms to classify
+%! ## a small set of unlabeled data points and evaluate the quality
+%! ## of the resulting clusters.
+%!
+%! ## Note: The input_data is taken from Chapter 13, Example 17 in
+%! ##       Fuzzy Logic: Intelligence, Control and Information, by
+%! ##       J. Yen and R. Langari, Prentice Hall, 1999, page 381
+%! ##       (International Edition). 
+%! 
+%! input_data = [2 12; 4 9; 7 13; 11 5; 12 7; 14 4]
+%! number_of_clusters = 2
+%! 
+%! ## Using fcm, classify the input data, print the cluster centers,
+%! ## and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   fcm (input_data, number_of_clusters, [NaN NaN NaN 0]);
+%! puts ("\nResults using the Fuzzy C-Means algorithm:\n\n");
+%! cluster_centers
+%! printf ("partition entropy (with a = 2): %f\n", ...
+%!         partition_entropy (soft_partition, 2));
+%! 
+%! ## Using gustafson_kessel, classify the input data, print the cluster
+%! ## centers, and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   gustafson_kessel (input_data, number_of_clusters, [1 1 1], ...
+%!                     [NaN NaN NaN 0]);
+%! puts ("\nResults using the Gustafson-Kessel algorithm:\n\n");
+%! cluster_centers
+%! printf ("partition entropy (with a = 2): %f\n\n", ...
+%!         partition_entropy (soft_partition, 2));
+
+##----------------------------------------------------------------------
+## Partition Entropy Demo #2
+##----------------------------------------------------------------------
+
+%!demo
+%! ## Use the Fuzzy C-Means and Gustafson-Kessel algorithms to classify
+%! ## three-dimensional unlabeled data points and evaluate the quality
+%! ## of the resulting clusters.
+%!
+%! ## Note: The input_data was selected to form three areas of
+%! ##       different shapes.
+%!
+%! input_data = [1 11 5; 1 12 6; 1 13 5; 2 11 7; 2 12 6; 2 13 7; 3 11 6;
+%!               3 12 5; 3 13 7;  1 1 10; 1 3 9; 2 2 11; 3 1 9; 3 3 10;
+%!               3 5 11; 4 4 9; 4 6 8; 5 5 8; 5 7 9; 6 6 10; 9 10 12;
+%!               9 12 13; 9 13 14; 10 9 13; 10 13 12; 11 10 14;
+%!               11 12 13; 12 6 12; 12 7 15; 12 9 15; 14 6 14; 14 8 13]
+%! number_of_clusters = 3
+%!
+%! ## Using fcm, classify the input data, print the cluster centers,
+%! ## and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   fcm (input_data, number_of_clusters, [NaN NaN NaN 0]);
+%! puts ("\nResults using the Fuzzy C-Means algorithm:\n\n");
+%! cluster_centers
+%! printf ("partition entropy (with a = 2): %f\n", ...
+%!         partition_entropy (soft_partition, 2));
+%! 
+%! ## Using gustafson_kessel, classify the input data, print the cluster
+%! ## centers, and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   gustafson_kessel (input_data, number_of_clusters, [1 1 1], ...
+%!                     [NaN NaN NaN 0]);
+%! puts ("\nResults using the Gustafson-Kessel algorithm:\n\n");
+%! cluster_centers
+%! printf ("partition entropy (with a = 2): %f\n\n", ...
+%!         partition_entropy (soft_partition, 2));
--- a/main/fuzzy-logic-toolkit/inst/xie_beni_index.m	Sat Aug 25 08:27:39 2012 +0000
+++ b/main/fuzzy-logic-toolkit/inst/xie_beni_index.m	Sun Aug 26 14:54:12 2012 +0000
@@ -41,7 +41,7 @@
 ## and @var{soft_partition} matrices, please see the documentation for function
 ## fcm.
 ##
-## @seealso{fcm, fcm_demo_1, fcm_demo_2, gustafson_kessel, gustafson_kessel_demo_1, gustafson_kessel_demo_2, partition_coeff, partition_entropy}
+## @seealso{fcm, gustafson_kessel, partition_coeff, partition_entropy}
 ##
 ## @end deftypefn
 
@@ -49,7 +49,7 @@
 ## Keywords:      fuzzy-logic-toolkit fuzzy xie beni cluster validity
 ## Directory:     fuzzy-logic-toolkit/inst/
 ## Filename:      xie_beni_index.m
-## Last-Modified: 19 Aug 2012
+## Last-Modified: 26 Aug 2012
 
 function vxb = xie_beni_index (input_data, cluster_centers, ...
                                soft_partition)
@@ -126,3 +126,77 @@
   d_sqr_min = min (min (d_sqr_matrix));
 
 endfunction
+
+##----------------------------------------------------------------------
+## Xie-Beni Index Demo #1
+##----------------------------------------------------------------------
+
+%!demo
+%! ## Use the Fuzzy C-Means and Gustafson-Kessel algorithms to classify
+%! ## a small set of unlabeled data points and evaluate the quality
+%! ## of the resulting clusters.
+%!
+%! ## Note: The input_data is taken from Chapter 13, Example 17 in
+%! ##       Fuzzy Logic: Intelligence, Control and Information, by
+%! ##       J. Yen and R. Langari, Prentice Hall, 1999, page 381
+%! ##       (International Edition). 
+%! 
+%! input_data = [2 12; 4 9; 7 13; 11 5; 12 7; 14 4]
+%! number_of_clusters = 2
+%! 
+%! ## Using fcm, classify the input data, print the cluster centers,
+%! ## and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   fcm (input_data, number_of_clusters, [NaN NaN NaN 0]);
+%! puts ("\nResults using the Fuzzy C-Means algorithm:\n\n");
+%! cluster_centers
+%! printf ("Xie-Beni index: %f\n", ...
+%!        xie_beni_index (input_data, cluster_centers, soft_partition));
+%! 
+%! ## Using gustafson_kessel, classify the input data, print the cluster
+%! ## centers, and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   gustafson_kessel (input_data, number_of_clusters, [1 1 1], ...
+%!                     [NaN NaN NaN 0]);
+%! puts ("\nResults using the Gustafson-Kessel algorithm:\n\n");
+%! cluster_centers
+%! printf ("Xie-Beni index: %f\n\n", ...
+%!        xie_beni_index (input_data, cluster_centers, soft_partition));
+
+##----------------------------------------------------------------------
+## Xie-Beni Index Demo #2
+##----------------------------------------------------------------------
+
+%!demo
+%! ## Use the Fuzzy C-Means and Gustafson-Kessel algorithms to classify
+%! ## three-dimensional unlabeled data points and evaluate the quality
+%! ## of the resulting clusters.
+%!
+%! ## Note: The input_data was selected to form three areas of
+%! ##       different shapes.
+%!
+%! input_data = [1 11 5; 1 12 6; 1 13 5; 2 11 7; 2 12 6; 2 13 7; 3 11 6;
+%!               3 12 5; 3 13 7;  1 1 10; 1 3 9; 2 2 11; 3 1 9; 3 3 10;
+%!               3 5 11; 4 4 9; 4 6 8; 5 5 8; 5 7 9; 6 6 10; 9 10 12;
+%!               9 12 13; 9 13 14; 10 9 13; 10 13 12; 11 10 14;
+%!               11 12 13; 12 6 12; 12 7 15; 12 9 15; 14 6 14; 14 8 13]
+%! number_of_clusters = 3
+%!
+%! ## Using fcm, classify the input data, print the cluster centers,
+%! ## and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   fcm (input_data, number_of_clusters, [NaN NaN NaN 0]);
+%! puts ("\nResults using the Fuzzy C-Means algorithm:\n\n");
+%! cluster_centers
+%! printf ("Xie-Beni index: %f\n", ...
+%!        xie_beni_index (input_data, cluster_centers, soft_partition));
+%! 
+%! ## Using gustafson_kessel, classify the input data, print the cluster
+%! ## centers, and calculate and print the partition coefficient.
+%! [cluster_centers, soft_partition, obj_fcn_history] = ...
+%!   gustafson_kessel (input_data, number_of_clusters, [1 1 1], ...
+%!                     [NaN NaN NaN 0]);
+%! puts ("\nResults using the Gustafson-Kessel algorithm:\n\n");
+%! cluster_centers
+%! printf ("Xie-Beni index: %f\n\n", ...
+%!        xie_beni_index (input_data, cluster_centers, soft_partition));