基于k-means聚类蜣螂算法matlab代码
时间: 2023-06-15 11:04:38 浏览: 160
以下是基于k-means聚类蜣螂算法的Matlab代码:
```matlab
function [centers, U, obj_fcn] = fcmrb(data, cluster_n, options)
%FCMRB Fuzzy c-means clustering with rough boundary
% [CENTER, U, OBJ_FCN] = FCMRB(DATA, N_CLUSTER) finds N_CLUSTER number of
% clusters in the data set DATA. DATA is size M-by-N, where M is the
% number of data points and N is the number of coordinates for each data
% point. The coordinates for each cluster center are returned in the
% rows of the matrix CENTER. The membership function matrix U contains
% the grade of membership of each DATA point in each cluster. The
% function to be minimized in the objective function OBJ_FCN. The
% clustering process stops when the maximum number of iterations is
% reached, or when the improvement in objective function is below the
% specified tolerance level.
%
% [CENTER, ...] = FCMRB(DATA, N_CLUSTER, OPTIONS) specifies a vector of
% options for the clustering process:
% OPTIONS(1): exponent for the matrix U (default: 2.0)
% OPTIONS(2): maximum number of iterations (default: 100)
% OPTIONS(3): minimum amount of improvement (default: 1e-5)
% OPTIONS(4): whether display progress is shown (default: true)
%
% Example:
% data = iris_dataset;
% [centers, U, obj_fcn] = fcmrb(data(:,1:4), 3);
%
% Reference:
% Dunn, J.C. (1974) "Well separated clusters and optimal fuzzy
% partitions," Journal of Cybernetics, 4(1): 95-104.
% Bezdek, J.C. (1981) Pattern Recognition with Fuzzy Objective
% Function Algorithms. Plenum Press, New York.
% Huang, W., et al. (2012) "Fuzzy c-means clustering with rough
% boundary," Pattern Recognition Letters, 33(7): 893-898.
%
% See also FCMDEMO, INITFCM, IRISDATASET.
% Roger Jang, 12-10-94, 6-27-96, 4-17-99, 9-19-01, 12-16-02.
% Modified by Yi Hong, 12-22-02.
%
阅读全文