12 lines
515 B
Mathematica
12 lines
515 B
Mathematica
|
% implements Classify, return the predicted class for each row (we'll call each row x) in data
|
||
|
% by computing the posterior probability that x is in class 1 vs. class 2 then
|
||
|
% these posterior probabilities are compared using the log odds.
|
||
|
function [predictions] = Classify(data, m1, m2, S1, S2, pc1, pc2)
|
||
|
|
||
|
% TODO: calculate P(x|C) * P(C) for both classes
|
||
|
|
||
|
% TODO: calculate log odds, if > 0 then data(i) belongs to class c1, else, c2
|
||
|
|
||
|
% TODO: get predictions from log odds calculation
|
||
|
|
||
|
end % Function end
|