-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfis.m
29 lines (24 loc) · 794 Bytes
/
fis.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
% set number of classes
clusters = 20;
% uncomment file you want to load
%fcmdata = load('a2.txt');
fcmdata = load('yeast.txt');
% find class for all points
[centers, U] = fcm(fcmdata, clusters);
maxU = max(U);
% match every point to a class
index = [];
for i = 1:clusters
temp = find(U(i,:) == maxU);
index(i).indexes = temp;
end
figure()
hold on
% generate table of unrepeatable colors
cmap = hsv(clusters);
% for every class plot it and scatter every point that belongs to it
for i = 1:clusters
scatter(fcmdata(index(i).indexes, 1), fcmdata(index(i).indexes, 2),25,cmap(i,:));
plot(centers(i, 1), centers(i, 2), '+', 'MarkerSize', 25, 'LineWidth',10, 'Color', 'black');
plot(centers(i, 1), centers(i, 2), '+', 'MarkerSize', 15, 'LineWidth',3, 'Color',cmap(i,:));
end