Skip to content

Commit

Permalink
fixed coding function issue in nytro_test and added new coding function
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffaello Camoriano committed Oct 29, 2015
1 parent 41c1904 commit 601945c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions codingFunctions/binaryClassification/zeroOneBin.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function [ Ypred ] = zeroOneBin( Yscores )
%zeroOneBin Encodes prediction vector as: Class 1: +1; Class 2: 0
% Detailed explanation goes here

if size(Yscores,2)>1
error('zeroOneBin is designed for binary classification coding');
end

Ypred = zeros(size(Yscores,1),1);
Ypred(Yscores>0.5) = 1;
end

2 changes: 1 addition & 1 deletion nytro_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
tic
output.YtePred = KnmTe * training_output.best.alpha;
if ~isempty(training_output.config.crossValidation.codingFunction)
output.YtePred = codingFunction(output.YtePred);
output.YtePred = training_output.config.crossValidation.codingFunction(output.YtePred);
end
output.time.prediction = toc;

Expand Down

0 comments on commit 601945c

Please sign in to comment.