-
Notifications
You must be signed in to change notification settings - Fork 0
/
dependency.m
68 lines (59 loc) · 1.95 KB
/
dependency.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
% Programmed by Javad Rahimipour Anaraki on 23/05/18
% Ph.D. Candidate
% Department of Computer Science
% Memorial University of Newfoundland
% jra066 [AT] mun [DOT] ca | www.cs.mun.ca/~jra066
% This is an implementation of to find dependency degree of input feautres
% Input: selected features
% Output: dependency degree
% More info: https://ieeexplore.ieee.org/document/5955425/
function out = dependency(binary)
global data;
[r, ~] = size(data);
cData = data;
maxF = [];
lenF = 0;
%%====================Calculating Indiscernibilities=======================
pData=[cData(:,1), cData(:,end)];
[indI, cls] = IND(pData);
tmp = zeros(1, length(cls));
v = std(data, 1);
maxF = find(binary == 1);
lenF = length(maxF);
s = 1;
supMat = [];
moRmF = zeros(1, lenF);
md = zeros(r, 3);
md(:, 1) = data(:, 1);
for x=1:r
for nCls = 1:length(cls)
part = indI(s:cls(nCls)); %U/IND(output)
for y = 1:r %for all data
if (~isempty(find(data(y,1) == part(1,:), 1)))
md(y, 2) = 1;
end
for h = 1:length(maxF)
Mf = maxF(h);
fTerm1 = (data(y,Mf)-(data(x,Mf)-v(Mf)))/(data(x,Mf)-(data(x,Mf)-v(Mf)));
fTerm2 = ((data(x,Mf)+v(Mf))-data(y,Mf))/((data(x,Mf)+v(Mf))-data(x,Mf));
moRmF(h) = max(min(fTerm1, fTerm2), 0);
end
if (length(moRmF) > 1)
outM = max(moRmF(1) + moRmF(2) - 1, 0);
for nMoRmF = 3:length(moRmF)
outM = max(outM + moRmF(nMoRmF) - 1, 0);
end
else
outM = min(moRmF);
end
md(y, 3) = min(1-outM + md(y, 2), 1);
end
tmp(nCls) = min(md(:, 3));
md = zeros(r, 3);
md(:, 1) = data(:, 1);
s = cls(nCls) + 1;
end
supMat(x) = max(tmp);
s = 1;
end
out = sum(supMat) / r;