matlab program of fuzzy c means final-edition

13
C-meansin matlab

Upload: chen-liu

Post on 14-Jun-2015

11.197 views

Category:

Technology


4 download

DESCRIPTION

This slide is aim to introduce a p

TRANSCRIPT

Page 1: Matlab program of fuzzy c means final-edition

C-means inmatlab

Page 2: Matlab program of fuzzy c means final-edition

K-Means

Basic K-means algorithm

Select K points as initial centroids.Repeat Form K clusters by assigning each point to its closest centroid. Recompute the centroid of each cluster.Until Centroids do not change.

Page 3: Matlab program of fuzzy c means final-edition

Basic Fuzzy C-Means algorithmAllow an object to belong to a set with a degree of membership between 0 to 1.

Fuzzy Clustering Fuzzy C-Means

Select an initial fuzzy pseudo-partition, i.e., assign values to all the Wij.RepeatCompute the centroid of each cluster using the fuzzy pseudo-partition.Recompute the fuzzy pseudo-partition, i.e. the Wij.Until The centroids do not change.

Page 4: Matlab program of fuzzy c means final-edition

Lack of programs of high quality

Single distance function

Poor effect

Nonsupport of sparse data

Page 5: Matlab program of fuzzy c means final-edition

Matlab R2009b

Fuzzy C-means

Some Distance Functions

Variable Neighborhood Search

Support of sparse dataand initialization Method

Page 6: Matlab program of fuzzy c means final-edition

Run_fcm.m

Loaddata_sparse.m

Loaddata_dense.m

Initialize.m

Initcenter.m

Iterate.m

Run_vns.m

To deal with input parameters and Call other functions

To load data of sparse or dense

Both of the files should be ASCII data

To preprocess data based on different distance functions for further analysis

To initialize centroids by random or given to start the algorithm The core of the Algorithm including updating membership matrix and centroids and computing objective function

To proceed VNS method

Page 7: Matlab program of fuzzy c means final-edition

Run_fcm

Loaddata_sparse Loaddata_sparse

Initialize

Initcenter

Iterate

Dismat0Distance_euc

Distance_cos Output

Run_vns Output

Structure of the program

Page 8: Matlab program of fuzzy c means final-edition

Deal with parameter

S

To attain a satisfied result, many input parameters are necessary. Such as

Distance function File style

Stop condition

Exponent

Max iterationThreshold Center type

The number of class Use VNS method or not

Although there times when we do not specify every parameters, since part of them could be defaults

function [matrixu, centroid, niter, obj,vnsobj] = run_fcm(nclass,fname,filesty, )varargin

internal.stats.getargs

[matrixu,centroid,niter,obj]=run_fcm(6,'la12.mat','sparse','expo',2,'distance','cosine','vns','on');

Page 9: Matlab program of fuzzy c means final-edition

Read and store sparse data

With the help of matlab function--------sparse()If we initialize a large matrix to store the whole data, that would be …Sparse data can not be Loaded directlyFopen() + Fgetl() + Strtok() + Spalloc()

Out of memory ! My solution is to cut them into pieces and then make them up.

Page 10: Matlab program of fuzzy c means final-edition
Page 11: Matlab program of fuzzy c means final-edition

Sparse data calculation

When data stored as sparse matrix, what kind of calculation could it do?

Basic operation between row vectors and another numerical value

Dot product between row vectors and another sparse vector

Ergodic of column vectors with zeros displayed

Sum-of-squares of row vectors

Logarithm of row vectors

Page 12: Matlab program of fuzzy c means final-edition

Variable Neighborhood Search

Page 13: Matlab program of fuzzy c means final-edition

THANKS

THANKS

Chen [email protected]