Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
function [TP, TN, FN, FP] = CalculateAcc(ytest, yhat, theta, upper, lower)
% This function calculates the accuracy of the test set based on
% the thresholds provided
% Parameters:
% ytest: the test set vector
% yhat: the raw test set predictions
% theta: the threshold for classification
% upper: the positive value of the test set
% lower: the negative value of the test set
TP = sum(and(ytest==upper, yhat >= theta));
FP = sum(and(ytest==lower, yhat >= theta));
TN = sum(and(ytest==lower, yhat < theta));
FN = sum(and(ytest==upper, yhat < theta));
end