Skip to content

Commit e5f8d9f

Browse files
authored
Add files via upload
1 parent fb4cc79 commit e5f8d9f

File tree

97 files changed

+14471
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+14471
-0
lines changed

Bayesian Classifier/Linearly separable data/18_ls.txt

Lines changed: 1500 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function [ A,B,C ] = case3par(m,c,m1,c1 )
2+
%Returns Parameters A,B & C which would be of form X'AX + B'X + C = 0 for
3+
%calculating decision boundary
4+
5+
A = -1/2*(inv(c) - inv(c1));
6+
B = inv(c)*m - inv(c1)*m1;
7+
C = -1/2*((m'*inv(c)*m) - (m1'*inv(c1)*m1)) - 1/2*log(det(c)/det(c1));
8+
9+
10+
end
11+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
% using addpath(genpath('/Users/NiravMBA/Desktop/IIT Madras/Semester I/Pattern Recognition/Assignment/Assignment 2/bosaris_toolkit'))
2+
3+
function [] = demo_main(target,nontarget,target1,nontarget1,target2,nontarget2,target3,nontarget3,target4,nontarget4,caseno)
4+
% To plot DET Curve
5+
6+
close all;
7+
8+
fprintf('You need to run this script in Matlab''s graphical mode to see the plots.\n');
9+
10+
% calculate an effective prior from target prior, Cmiss, and Cfa
11+
prior = effective_prior(0.33,1,1);
12+
13+
14+
%% Assign Target and Non Target Scores
15+
16+
17+
test_data.tar1 = target;
18+
test_data.non1 = nontarget;
19+
20+
test_data.tar2 = target1;
21+
test_data.non2 = nontarget1;
22+
23+
test_data.tar3 = target2;
24+
test_data.non3 = nontarget2;
25+
26+
test_data.tar4 = target3;
27+
test_data.non4 = nontarget3;
28+
29+
test_data.tar5 = target4;
30+
test_data.non5 = nontarget4;
31+
32+
33+
%% make a DET plot for all the five cases.
34+
demo_plot_det_for_fusion(test_data,prior,caseno);
35+
36+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function [ A,B,C ] = disciminantFunction(m,c )
2+
%Returns Parameter A,B & C for decison boundary which is of form
3+
% X'AX + B'X + C = 0.
4+
5+
A = -1/2*inv(c);
6+
B = inv(c)*m;
7+
C = -1/2*m'*inv(c)*m - 1/2*log(det(c));
8+
9+
10+
end
11+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
clc; clear all; close all
2+
3+
%% Calling Bayesian Classifier function for all five cases
4+
5+
% CaseNumber: 1 -- Bayes with Covariance same for all classes
6+
%
7+
% 2 -- Bayes with Covariance different for all classes
8+
%
9+
% 3 -- Naive Bayes with C = \sigma^2*I.
10+
%
11+
% 4 -- Naive Bayes with C same for all classes.
12+
%
13+
% 5 -- Naive Bayes with C different for all classes.
14+
15+
16+
[t,nt] = myBayesianClassifier(1);
17+
[t1,nt1] = myBayesianClassifier(2);
18+
[t2,nt2] = myBayesianClassifier(3);
19+
[t3,nt3] = myBayesianClassifier(4);
20+
[t4,nt4] = myBayesianClassifier(5);
21+
22+
%% Uncomment this to plot ROC
23+
% legend('Case 1','Case 2','Case 3','Case 4','Case 5')
24+
% print('-djpeg','LS_ROC.jpg', '-r300');
25+
% hold off
26+
27+
28+
%% Uncomment this to plot DET
29+
% demo_main(t,nt,t1,nt1,t2,nt2,t3,nt3,t4,nt4,1);
30+
% print('-djpeg','LS_DET.jpg', '-r300');
31+
32+
33+
close all

0 commit comments

Comments
 (0)