-
Notifications
You must be signed in to change notification settings - Fork 1
/
TEMPLATE_ncRNA_testing.m
executable file
·42 lines (33 loc) · 1.27 KB
/
TEMPLATE_ncRNA_testing.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
function [errsTrainFalsePos,errsTrainFalseNeg,errsTestFalsePos,errsTestFalseNeg] = %FUNCTONNAME%()
% Initial values
%tic;
M = 200;
[tX,tT,tH] = %TRAINING%();
[hX,hT,hH] = %HOLDING%();
trainset = cell2mat(tX);%converting to matricies
train_t = cell2mat(tT);
testset = cell2mat(hX);
test_t = cell2mat(hT);
N = length(train_t);
Nt = length(test_t);
[trainset, mu, sig] = zscore(trainset);
testset = (testset - repmat(mu, Nt, 1)) ./ repmat(sig, Nt, 1) ;
% Estimate
%profile on -history -timer 'real'
model = cRumTrainKMeansMAP(trainset, train_t, M, true, 2, 10, 1000000, 1e-03);
%profile viewer
%toc;
%save %FUNCTONNAME%_model model
y = cRumClassify(model, trainset);
errsTrainFalsePos = sum(y(train_t == 0) > 0.5);
errsTrainFalseNeg = sum(y(train_t == 1) <= 0.5);
fprintf('M: %d\n', M);
fprintf('CRUM CLASSIFICATION train error: %.2f%%\n', errsTrainFalsePos / N *100);
fprintf('CRUM CLASSIFICATION train error: %.2f%%\n', errsTrainFalseNeg / N *100);
% Test
y = cRumClassify(model, testset);
errsTestFalsePos = sum(y(test_t == 0) > 0.5);
errsTestFalseNeg = sum(y(test_t == 1) <= 0.5);
fprintf('CRUM CLASSIFICATION test error: %.2f%%\n', errsTestFalsePos / Nt *100);
fprintf('CRUM CLASSIFICATION test error: %.2f%%\n', errsTestFalseNeg / Nt *100);
end