-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathP_m.m
More file actions
27 lines (22 loc) · 634 Bytes
/
P_m.m
File metadata and controls
27 lines (22 loc) · 634 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
%Function for deteming the bayesian probabilities with the pignistic
% transformation method
%
% [P(x)=sum(m(A)/|A|) for all x subset A]
%
function [ P ] = P_m( m )
Keys = keys(m);
single_keys = cell([1 log2(length(Keys))]);
P_m = zeros([1 log2(length(Keys))]);
index = 1;
for i = 2:length(Keys)
if length(Keys{i}) == 1
tmpKeys = allSubsetsContainingKey(Keys, Keys{i});
single_keys{index} = Keys{i};
for j = 1:length(tmpKeys)
P_m(index) = P_m(index) + m(tmpKeys{j})/length(tmpKeys{j});
end;
index = index + 1;
end;
end;
P = containers.Map(single_keys, P_m);
end