function sheet12
% ROC-curves

sheet12_data % loads X, Y, Y1 and Y2

% plot the data
figure(1)
plot(X(Y == 1, 1), X(Y == 1, 2), 'r+', ...
     X(Y == -1, 1), X(Y == -1, 2), 'bo');
legend('positive', 'negative');

% plot the first Ys
figure(2)
scatter(X(:, 1), X(:, 2), 20, Y1, 'filled');
title('predicitons 1')

figure(3)
scatter(X(:, 1), X(:, 2), 20, Y2, 'filled');
title('predicitons 2')

figure(4)
[FPR1, TPR1] = roc_curve(Y, Y1);
[FPR2, TPR2] = roc_curve(Y, Y2);
title('ROC')
plot(FPR1, TPR1, 'r-', FPR2, TPR2, 'b-')
legend('1', '2');
xlabel('false positive rate')
ylabel('true positive rate')

figure(5)
[P1, R1] = pr_curve(Y, Y1);
[P2, R2] = pr_curve(Y, Y2);
title('ROC')
plot(P1, R1, 'r-', P2, R2, 'b-')
legend('1', '2');
xlabel('precision');
ylabel('recall');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Your solutions below

% 1a. count the number of false positives. Yt are the true labels, Yp are the
% predicted ones.
function N = fp(Yt, Yp)
% ...

% 1b. count the number of true positives.
function N = tp(Yt, Yp)
% ...

% 1c. count the number of false negatives.
function N = fn(Yt, Yp)
% ...

% 1d. count the number of true negatives.
function N = tn(Yt, Yp)
% ...

% 2a. compute the false positive rate between Yt and Yp, where Yt are the
% true labels and Yp are the predicted labels.
function R = fpr(Yt, Yp)
% ...

% 2b. compute the true positive rate
function R = tpr(Yt, Yp)
% ...

% 2c. compute the precision
function R = precision(Yt, Yp)
% ...

% 2d. compute the recall
function R = recall(Yt, Yp)
% ...

% 3a. Compute the values for the roc-curve
function [FPR, TPR] = roc_curve(Yt, Yp)
% ...

% 3b. compute the values for the precision-recall curve
function [P, R] = pr_curve(Yt, Yp)
% ...
