-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrain.m
More file actions
48 lines (41 loc) · 954 Bytes
/
Train.m
File metadata and controls
48 lines (41 loc) · 954 Bytes
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function W = FCM(ADCInd)
%n = size(concepts);
n = 42;
A = initial_activation(n);
W = initial_weight(n);
%conceptOrder = sort_concept(concepts);
M = 100;
b = 0.2;
lambda = 0.02;
e = 0.02;
newA = A;
J = zeros(1, M);
c = 1;
eta = 0.02 * exp(-0.2);
gamma = b * exp(-lambda);
criterion = 0;
while (~criterion)
currentA = newA;
if (c > M)
c = 1;
eta = 0.02 * exp(-0.2*c);
gamma = b * exp(-lambda * c);
end
[newA newW] = AHL(W, currentA, eta, gamma);
J(c) = sqrt(sum((newA(ADCInd)-min(newA)).^2+(newA(ADCInd)-max(newA)).^2));
if (c > 2)
if (~(J(c-2) > J(c-1) && J(c-1) > J(c)))
c = c+1;
else
if (max(newA(ADCInd)-currentA(ADCInd)) > e)
c = c+1;
else
criterion = 1;
end
end
else
c = c+1;
end
W = newW;
save('result.txt', 'W');
end