From: <lm...@us...> - 2012-10-03 00:38:17
|
Revision: 11097 http://octave.svn.sourceforge.net/octave/?rev=11097&view=rev Author: lmarkov Date: 2012-10-03 00:38:09 +0000 (Wed, 03 Oct 2012) Log Message: ----------- M inst/hamacher_product.m M inst/partition_coeff.m M inst/heart_disease_risk.fis M inst/einstein_product.m M inst/mamdani_tip_calculator.fis M inst/sugeno_tip_demo.m M inst/cubic_approx_demo.m M inst/drastic_product.m M inst/linear_tip_demo.m M inst/hamacher_sum.m M inst/rmmf.m M inst/einstein_sum.m M inst/fcm.m M inst/xie_beni_index.m M inst/sugeno_tip_calculator.fis M inst/drastic_sum.m M inst/investment_portfolio.fis M inst/gustafson_kessel.m M inst/cubic_approximator.fis M inst/linear_tip_calculator.fis M inst/heart_disease_demo_1.m M inst/heart_disease_demo_2.m M inst/partition_entropy.m Modified Paths: -------------- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approx_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approximator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/drastic_product.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/drastic_sum.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/einstein_product.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/einstein_sum.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/fcm.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gustafson_kessel.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/hamacher_product.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/hamacher_sum.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_demo_1.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_demo_2.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_risk.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/investment_portfolio.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_calculator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_calculator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/partition_coeff.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/partition_entropy.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/rmmf.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno_tip_calculator.fis trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno_tip_demo.m trunk/octave-forge/main/fuzzy-logic-toolkit/inst/xie_beni_index.m Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approx_demo.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approx_demo.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approx_demo.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -41,7 +41,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy tests demos ## Directory: fuzzy-logic-toolkit/inst ## Filename: cubic_approx_demo.m -## Last-Modified: 12 Nov 2011 +## Last-Modified: 20 Aug 2012 ## Read the FIS structure from a file. fis = readfis ('cubic_approximator.fis'); Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approximator.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approximator.fis 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/cubic_approximator.fis 2012-10-03 00:38:09 UTC (rev 11097) @@ -1,3 +1,27 @@ +## Copyright (C) 2011-2012 L. Markowsky <lm...@us...> +## +## 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/>. + +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fis +## Directory: fuzzy-logic-toolkit/inst/ +## Filename: cubic_approximator.fis +## Last-Modified: 28 Aug 2012 + [System] Name='Cubic-Approximator' Type='sugeno' Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/drastic_product.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/drastic_product.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/drastic_product.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -44,7 +44,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy drastic_product ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: drastic_product.m -## Last-Modified: 12 Nov 2011 +## Last-Modified: 20 Aug 2012 function retval = drastic_product (x, y = 0) if (nargin == 0 || nargin > 2 || Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/drastic_sum.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/drastic_sum.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/drastic_sum.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -44,7 +44,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy drastic_sum ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: drastic_sum.m -## Last-Modified: 12 Nov 2011 +## Last-Modified: 20 Aug 2012 function retval = drastic_sum (x, y = 0) if (nargin == 0 || nargin > 2 || Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/einstein_product.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/einstein_product.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/einstein_product.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -39,7 +39,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy einstein_product ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: einstein_product.m -## Last-Modified: 12 Nov 2011 +## Last-Modified: 20 Aug 2012 function retval = einstein_product (x, y = 0) if (nargin == 0 || nargin > 2 || Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/einstein_sum.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/einstein_sum.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/einstein_sum.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -38,7 +38,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy einstein_sum ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: einstein_sum.m -## Last-Modified: 12 Nov 2011 +## Last-Modified: 20 Aug 2012 function retval = einstein_sum (x, y = 0) if (nargin == 0 || nargin > 2 || Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/fcm.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/fcm.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/fcm.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -25,10 +25,12 @@ ## @deftypefnx {Function File} {[@var{cluster_centers}, @var{soft_partition}, @var{obj_fcn_history}] =} fcm (@var{input_data}, @var{num_clusters}, [@var{m}, @var{max_iterations}, @var{epsilon}, @var{display_intermediate_results}]) ## ## Using the Fuzzy C-Means algorithm, calculate and return the soft partition -## of a set of unlabeled data points. +## of a set of unlabeled data points. ## ## Also, if @var{display_intermediate_results} is true, display intermediate -## results after each iteration. +## results after each iteration. Note that because the initial cluster +## prototypes are randomly selected locations in the ranges determined by the +## input data, the results of this function are nondeterministic. ## ## The required arguments to fcm are: ## @itemize @w @@ -111,10 +113,10 @@ ## @end deftypefn ## Author: L. Markowsky -## Keywords: fuzzy-logic-toolkit fuzzy partition clustering fcm +## Keywords: fuzzy-logic-toolkit fuzzy partition clustering ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: fcm.m -## Last-Modified: 26 Aug 2012 +## Last-Modified: 5 Sep 2012 function [cluster_centers, soft_partition, obj_fcn_history] = ... fcm (input_data, num_clusters, options = [2.0, 100, 1e-5, 1]) @@ -175,8 +177,8 @@ fcm_private (X, k, m, max_iterations, epsilon, ... display_intermediate_results) - ## Initialize the prototype and the calculation. - V = fcm_init_prototype (X, k); + ## Initialize the prototypes and the calculation. + V = init_cluster_prototypes (X, k); obj_fcn_history = zeros (max_iterations); convergence_criterion = epsilon + 1; iteration = 0; @@ -191,18 +193,18 @@ while (convergence_criterion > epsilon && ... ++iteration <= max_iterations) V_previous = V; - Mu = fcm_update_membership_fcn (V, X, m, k, n, sqr_dist); + Mu = update_cluster_membership (V, X, m, k, n, sqr_dist); Mu_m = Mu .^ m; - V = fcm_update_cluster_centers (Mu_m, X, k); + V = update_cluster_prototypes (Mu_m, X, k); sqr_dist = square_distance_matrix (X, V); obj_fcn_history(iteration) = ... - fcm_compute_objective_fcn (Mu_m, sqr_dist); + compute_cluster_obj_fcn (Mu_m, sqr_dist); if (display_intermediate_results) printf ("Iteration count = %d, Objective fcn = %8.6f\n", ... iteration, obj_fcn_history(iteration)); endif convergence_criterion = ... - fcm_compute_convergence_criterion (V, V_previous); + compute_cluster_convergence (V, V_previous); endwhile ## Remove extraneous entries from the tail of the objective @@ -219,15 +221,18 @@ %!demo %! ## This demo: -%! ## - classifies a small set of unlabeled data points using the -%! ## Fuzzy C-Means algorithm into two fuzzy clusters +%! ## - 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 +%! ## - evaluates the quality of the resulting clusters using +%! ## three validity measures: the partition coefficient, the +%! ## partition entropy, and the Xie-Beni validity index %! ## %! ## 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; @@ -241,14 +246,14 @@ %! '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 @@ -258,6 +263,15 @@ %! ylabel ('Feature 2'); %! grid %! hold +%! +%! ## 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)); ##---------------------------------------------------------------------- ## FCM Demo #2 @@ -265,19 +279,23 @@ %!demo %! ## This demo: -%! ## - classifies three-dimensional unlabeled data points using the -%! ## Fuzzy C-Means algorithm into three fuzzy clusters +%! ## - 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 +%! ## - evaluates the quality of the resulting clusters using +%! ## three validity measures: the partition coefficient, the +%! ## partition entropy, and the Xie-Beni validity index %! ## %! ## 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]; +%! 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]) @@ -291,8 +309,8 @@ %! hold on; %! endfor %! -%! ## Plot the cluster centers in two dimensions (using features 1 & 2) -%! ## as larger red *'s. +%! ## 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'); @@ -309,8 +327,8 @@ %! grid %! hold %! -%! ## Plot the data points in two dimensions (using features 1 & 3) -%! ## as small blue x's. +%! ## 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, ... @@ -318,8 +336,8 @@ %! hold on; %! endfor %! -%! ## Plot the cluster centers in two dimensions (using features 1 & 3) -%! ## as larger red *'s. +%! ## 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'); @@ -335,3 +353,12 @@ %! ylabel ('Feature 3'); %! grid %! hold +%! +%! ## 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)); Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gustafson_kessel.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gustafson_kessel.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/gustafson_kessel.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -27,10 +27,12 @@ ## @deftypefnx {Function File} {[@var{cluster_centers}, @var{soft_partition}, @var{obj_fcn_history}] =} gustafson_kessel (@var{input_data}, @var{num_clusters}, @var{cluster_volume}, [@var{m}, @var{max_iterations}, @var{epsilon}, @var{display_intermediate_results}]) ## ## Using the Gustafson-Kessel algorithm, calculate and return the soft partition -## of a set of unlabeled data points. +## of a set of unlabeled data points. ## ## Also, if @var{display_intermediate_results} is true, display intermediate -## results after each iteration. +## results after each iteration. Note that because the initial cluster +## prototypes are randomly selected locations in the ranges determined by the +## input data, the results of this function are nondeterministic. ## ## The required arguments to gustafson_kessel are: ## @itemize @w @@ -119,7 +121,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy partition clustering ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: gustafson_kessel.m -## Last-Modified: 26 Aug 2012 +## Last-Modified: 5 Sep 2012 function [cluster_centers, soft_partition, obj_fcn_history] = ... gustafson_kessel (input_data, num_clusters, ... @@ -194,8 +196,8 @@ gustafson_kessel_private (X, k, cluster_volume, m, max_iterations, ... epsilon, display_intermediate_results) - ## Initialize the prototype and the calculation. - V = fcm_init_prototype (X, k); + ## Initialize the prototypes and the calculation. + V = init_cluster_prototypes (X, k); obj_fcn_history = zeros (max_iterations); convergence_criterion = epsilon + 1; iteration = 0; @@ -210,18 +212,18 @@ while (convergence_criterion > epsilon && ... ++iteration <= max_iterations) V_previous = V; - Mu = fcm_update_membership_fcn (V, X, m, k, n, sqr_dist); + Mu = update_cluster_membership (V, X, m, k, n, sqr_dist); Mu_m = Mu .^ m; - V = fcm_update_cluster_centers (Mu_m, X, k); + V = update_cluster_prototypes (Mu_m, X, k); sqr_dist = gk_square_distance_matrix (X, V, Mu_m, cluster_volume); obj_fcn_history(iteration) = ... - fcm_compute_objective_fcn (Mu_m, sqr_dist); + compute_cluster_obj_fcn (Mu_m, sqr_dist); if (display_intermediate_results) printf ("Iteration count = %d, Objective fcn = %8.6f\n", ... iteration, obj_fcn_history(iteration)); endif convergence_criterion = ... - fcm_compute_convergence_criterion (V, V_previous); + compute_cluster_convergence (V, V_previous); endwhile ## Remove extraneous entries from the tail of the objective ... @@ -289,9 +291,12 @@ %!demo %! ## This demo: -%! ## - classifies a small set of unlabeled data points using the -%! ## Gustafson-Kessel algorithm into two fuzzy clusters +%! ## - 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 +%! ## - evaluates the quality of the resulting clusters using +%! ## three validity measures: the partition coefficient, the +%! ## partition entropy, and the Xie-Beni validity index %! ## %! ## Note: The input_data is taken from Chapter 13, Example 17 in %! ## Fuzzy Logic: Intelligence, Control and Information, by @@ -314,8 +319,8 @@ %! %! ## 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'); +%! plot (cluster_centers(i, 1), cluster_centers(i, 2), ... +%! 'LineWidth', 4, 'marker', '*', 'color', 'r'); %! hold on; %! endfor %! @@ -328,26 +333,39 @@ %! ylabel ('Feature 2'); %! grid %! hold - +%! +%! ## 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)); + ##---------------------------------------------------------------------- ## Gustafson-Kessel Demo #2 ##---------------------------------------------------------------------- %!demo %! ## This demo: -%! ## - classifies three-dimensional unlabeled data points using the -%! ## Gustafson-Kessel algorithm into three fuzzy clusters +%! ## - classifies three-dimensional unlabeled data points using +%! ## the Gustafson-Kessel algorithm into three fuzzy clusters %! ## - plots the input points together with the cluster centers +%! ## - evaluates the quality of the resulting clusters using +%! ## three validity measures: the partition coefficient, the +%! ## partition entropy, and the Xie-Beni validity index %! ## %! ## 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]; +%! 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], ... @@ -362,11 +380,11 @@ %! hold on; %! endfor %! -%! ## Plot the cluster centers in two dimensions (using features 1 & 2) -%! ## as larger red *'s. +%! ## 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'); +%! plot (cluster_centers(i, 1), cluster_centers(i, 2), ... +%! 'LineWidth', 4, 'marker', '*', 'color', 'r'); %! hold on; %! endfor %! @@ -379,8 +397,8 @@ %! ylabel ('Feature 2'); %! grid %! -%! ## Plot the data points in two dimensions (using features 1 & 3) -%! ## as small blue x's. +%! ## 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, ... @@ -388,11 +406,11 @@ %! hold on; %! endfor %! -%! ## Plot the cluster centers in two dimensions (using features 1 & 3) -%! ## as larger red *'s. +%! ## 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'); +%! plot (cluster_centers(i, 1), cluster_centers(i, 3), ... +%! 'LineWidth', 4, 'marker', '*', 'color', 'r'); %! hold on; %! endfor %! @@ -405,3 +423,12 @@ %! ylabel ('Feature 3'); %! grid %! hold +%! +%! ## 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)); Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/hamacher_product.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/hamacher_product.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/hamacher_product.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -39,7 +39,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy hamacher_product ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: hamacher_product.m -## Last-Modified: 12 Nov 2011 +## Last-Modified: 20 Aug 2012 function retval = hamacher_product (x, y = 0) if (nargin == 0 || nargin > 2 || Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/hamacher_sum.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/hamacher_sum.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/hamacher_sum.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -39,7 +39,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy hamacher_sum ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: hamacher_sum.m -## Last-Modified: 12 Nov 2011 +## Last-Modified: 20 Aug 2012 function retval = hamacher_sum (x, y = 0) if (nargin == 0 || nargin > 2 || Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_demo_1.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_demo_1.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_demo_1.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -47,7 +47,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy tests demos ## Directory: fuzzy-logic-toolkit/inst ## Filename: heart_disease_demo_1.m -## Last-Modified: 12 Nov 2011 +## Last-Modified: 20 Aug 2012 ## Create new FIS. a = newfis ('Heart-Disease-Risk', 'sugeno', ... Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_demo_2.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_demo_2.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_demo_2.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -45,7 +45,7 @@ ## Dr. Bruce Segee (University of Maine Dept. of ECE). ## Directory: fuzzy-logic-toolkit/inst ## Filename: heart_disease_demo_2.m -## Last-Modified: 12 Nov 2011 +## Last-Modified: 20 Aug 2012 ## Read the FIS structure from a file. ## (Alternatively, to select heart_disease_risk.fis using the dialog, Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_risk.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_risk.fis 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/heart_disease_risk.fis 2012-10-03 00:38:09 UTC (rev 11097) @@ -1,5 +1,29 @@ -# Heart Disease Risk FIS +## Copyright (C) 2011-2012 L. Markowsky <lm...@us...> +## +## 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/>. +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fis +## Directory: fuzzy-logic-toolkit/inst/ +## Filename: heart_disease_risk.fis +## Last-Modified: 28 Aug 2012 + +## Heart Disease Risk FIS + [System] Name = 'Heart-Disease-Risk' Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/investment_portfolio.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/investment_portfolio.fis 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/investment_portfolio.fis 2012-10-03 00:38:09 UTC (rev 11097) @@ -1,3 +1,27 @@ +## Copyright (C) 2011-2012 L. Markowsky <lm...@us...> +## +## 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/>. + +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fis +## Directory: fuzzy-logic-toolkit/inst/ +## Filename: investment_portfolio.fis +## Last-Modified: 28 Aug 2012 + [System] Name='Investment-Portfolio' Type='mamdani' Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_calculator.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_calculator.fis 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_calculator.fis 2012-10-03 00:38:09 UTC (rev 11097) @@ -1,3 +1,27 @@ +## Copyright (C) 2011-2012 L. Markowsky <lm...@us...> +## +## 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/>. + +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fis +## Directory: fuzzy-logic-toolkit/inst/ +## Filename: linear_tip_calculator.fis +## Last-Modified: 28 Aug 2012 + [System] Name='Linear-Tip-Calculator' Type='sugeno' Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_demo.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_demo.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/linear_tip_demo.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -43,7 +43,7 @@ ## Dr. Bruce Segee (University of Maine Dept. of ECE). ## Directory: fuzzy-logic-toolkit/inst ## Filename: linear_tip_demo.m -## Last-Modified: 12 Nov 2011 +## Last-Modified: 20 Aug 2012 ## Read the FIS structure from a file. fis = readfis ('linear_tip_calculator.fis'); Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_calculator.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_calculator.fis 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/mamdani_tip_calculator.fis 2012-10-03 00:38:09 UTC (rev 11097) @@ -1,3 +1,27 @@ +## Copyright (C) 2011-2012 L. Markowsky <lm...@us...> +## +## 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/>. + +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fis +## Directory: fuzzy-logic-toolkit/inst/ +## Filename: mamdani_tip_calculator.fis +## Last-Modified: 28 Aug 2012 + [System] Name='Mamdani-Tip-Calculator' Type='mamdani' Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/partition_coeff.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/partition_coeff.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/partition_coeff.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -33,6 +33,12 @@ ## @var{vpc} - the partition coefficient for the given soft partition ## @end itemize ## +## For demos of this function, please type: +## @example +## demo 'fcm' +## demo 'gustafson_kessel' +## @end example +## ## For more information about the @var{soft_partition} matrix, please see the ## documentation for function fcm. ## @@ -44,7 +50,7 @@ ## Keywords: fuzzy-logic-toolkit partition coefficient cluster ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: partition_coeff.m -## Last-Modified: 26 Aug 2012 +## Last-Modified: 4 Sep 2012 ##---------------------------------------------------------------------- ## Note: This function is an implementation of Equation 13.9 (corrected @@ -78,77 +84,3 @@ 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)); Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/partition_entropy.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/partition_entropy.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/partition_entropy.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -35,6 +35,12 @@ ## @var{vpe} - the partition entropy for the given soft partition ## @end itemize ## +## For demos of this function, please type: +## @example +## demo 'fcm' +## demo 'gustafson_kessel' +## @end example +## ## For more information about the @var{soft_partition} matrix, please see the ## documentation for function fcm. ## @@ -46,7 +52,7 @@ ## Keywords: fuzzy-logic-toolkit partition entropy cluster ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: partition_entropy.m -## Last-Modified: 26 Aug 2012 +## Last-Modified: 4 Sep 2012 ##---------------------------------------------------------------------- ## Note: This function is an implementation of Equation 13.10 in @@ -86,77 +92,3 @@ 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)); Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/rmmf.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/rmmf.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/rmmf.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -46,7 +46,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy membership ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: rmmf.m -## Last-Modified: 16 Jul 2011 +## Last-Modified: 20 Aug 2012 function fis = rmmf (fis, in_or_out, var_index, mf, mf_index) Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno_tip_calculator.fis =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno_tip_calculator.fis 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno_tip_calculator.fis 2012-10-03 00:38:09 UTC (rev 11097) @@ -1,3 +1,27 @@ +## Copyright (C) 2011-2012 L. Markowsky <lm...@us...> +## +## 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/>. + +## Author: L. Markowsky +## Keywords: fuzzy-logic-toolkit fis +## Directory: fuzzy-logic-toolkit/inst/ +## Filename: sugeno_tip_calculator.fis +## Last-Modified: 28 Aug 2012 + % Sugeno Tip Calculator % Computes cheap, average, and generous tips Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno_tip_demo.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno_tip_demo.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/sugeno_tip_demo.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -49,7 +49,7 @@ ## Dr. Bruce Segee (University of Maine Dept. of ECE). ## Directory: fuzzy-logic-toolkit/inst ## Filename: sugeno_tip_demo.m -## Last-Modified: 10 Nov 2011 +## Last-Modified: 20 Aug 2012 ## Read the FIS structure from a file. fis = readfis ('sugeno_tip_calculator.fis'); Modified: trunk/octave-forge/main/fuzzy-logic-toolkit/inst/xie_beni_index.m =================================================================== --- trunk/octave-forge/main/fuzzy-logic-toolkit/inst/xie_beni_index.m 2012-10-03 00:37:18 UTC (rev 11096) +++ trunk/octave-forge/main/fuzzy-logic-toolkit/inst/xie_beni_index.m 2012-10-03 00:38:09 UTC (rev 11097) @@ -37,6 +37,12 @@ ## @var{vxb} - the Xie-Beni validity index for the given partition ## @end itemize ## +## For demos of this function, please type: +## @example +## demo 'fcm' +## demo 'gustafson_kessel' +## @end example +## ## For more information about the @var{input_data}, @var{cluster_centers}, ## and @var{soft_partition} matrices, please see the documentation for function ## fcm. @@ -49,7 +55,7 @@ ## Keywords: fuzzy-logic-toolkit fuzzy xie beni cluster validity ## Directory: fuzzy-logic-toolkit/inst/ ## Filename: xie_beni_index.m -## Last-Modified: 26 Aug 2012 +## Last-Modified: 4 Sep 2012 function vxb = xie_beni_index (input_data, cluster_centers, ... soft_partition) @@ -126,77 +132,3 @@ 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)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |