IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
calc_predictive_values.m
Go to the documentation of this file.
1 %>@ingroup maths
2 %> @file
3 %> @brief Calculates predictive values
4 %> @code
5 %> P(a|A) = P(A|a)*P(a)/P(A)
6 %> @endcode
7 %> However this formula is not used, because it is easier to use a column of the confusion matrix
8 %>
9 %> P(a|A) is the probability of belonging to
10 %> class 'a' given that you have been classified as so.
11 %
12 %> @param cc confusion matrix in HITS, NOT PERCENTAGE
13 %> @return \em values predictive values for each column of cc
14 function values = calc_predictive_values(cc)
15 
16 
17 no_classes = size(cc, 2);
18 
19 values = zeros(1, no_classes);
20 
21 for i = 1:no_classes
22 
23  % P(a|A) = P(A|a)*P(a)/P(A)
24  %
25  % P(A|a) = n_aA/n_a
26  % P(a) = n_a/n
27  % P(A) = n_A/n
28  %
29  % The formula simplifies to
30  % P(a|A) = n_aA/n_A
31  values(i) = cc(i, i)/sum(cc(:, i));
32 end;
function calc_predictive_values(in cc)
Analysis Session (AS) base class.
Definition: as.m:6