How to view all U matrix for each iteration in Fuzzy c means clustering ?
1 view (last 30 days)
Show older comments
SWAMI NATHAN
on 3 Jul 2015
Commented: SWAMI NATHAN
on 28 Aug 2015
How to view all U matrix for each iteration in Fuzzy c means clustering ?
0 Comments
Accepted Answer
Walter Roberson
on 28 Aug 2015
Loop around from 1 to the number of iterations you want. The default for fcm() is 100; if you wanted to match that, then you would loop to 100. Call the loop control variable L
In each loop, you would set the random number generator seed to the same value. Then call fcm() passing in your data, then the number of clusters, and then the vector [2, L, 1e-5, 1] which will be your options vector. The second element of the options vector is the number of loop iterations that fcm is to do, so each time you will be telling fcm to do one more iteration than the time you ran it before. Record or otherwise process the U result.
For example:
randseed = 54321;
numcluster = 5;
maxiter = 100;
U = cell(maxiter, 1);
for L = 1 : maxiter
rng(randseed); %must be reset to the same value each time
[~, U{L}, ~] = fcm(YourData, numcluster, [2, L, 1e-5, 1]);
end
Now U{1} will be the U after the first iteration, U{2} will be the U after the second iteration, and so on.
More Answers (0)
See Also
Categories
Find more on Fuzzy Logic Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!