%Graphs

for v = 1:length(NeighallPGTetS)
    if NeighallPGTetS(v,2) <= 500
        NeighallPGTetS(v,3) = 2;
    else
        NeighallPGTetS(v,3) = 1;
    end
end
for v = 1:length(NeighallTetPGS)
    if NeighallTetPGS(v,2) <= 500
        NeighallTetPGS(v,3) = 1;
    else
        NeighallTetPGS(v,3) = 0;
    end
end




%protocol for my comparison for 190928
[Neigh_PGWav Neigh_Dist_PGWav] = kNearestNeighbors(max_sample_PG, max_sample_wav,1);
[Neigh_WavPG Neigh_Dist_WavPG] = kNearestNeighbors(max_sample_wav, max_sample_PG,1);
Neigh_all_PGWav = [Neigh_PGWav Neigh_Dist_PGWav];
Neigh_all_WavPG = [Neigh_WavPG Neigh_Dist_WavPG];

for v = 1:length(Neigh_all_WavPG)
    if Neigh_all_WavPG(v,2) <= 500
        Neigh_all_WavPG(v,3) = 2;
    else
        Neigh_all_WavPG(v,3) = 1;
    end
end
for v = 1:length(Neigh_all_PGWav)
    if Neigh_all_PGWav(v,2) <= 500
        Neigh_all_PGWav(v,3) = 1;
    else
        Neigh_all_PGWav(v,3) = 0;
    end
end
ConfusionPGWav = [Neigh_all_WavPG(:,3)];
%then add a 0 on the end of it for every 0 in PGWav

%doing the comparison for 132928
[Neigh_PGWav13 Neigh_Dist_PGWav13] = kNearestNeighbors(max_sample_PG13, max_sample_wav13,1);
[Neigh_WavPG13 Neigh_Dist_WavPG13] = kNearestNeighbors(max_sample_wav13, max_sample_PG13,1);
Neigh_all_PGWav13 = [Neigh_PGWav13 Neigh_Dist_PGWav13];
Neigh_all_WavPG13 = [Neigh_WavPG13 Neigh_Dist_WavPG13];
%not doing that for 1000+ lines so i'll make matlab do it for me
for v = 1:length(Neigh_all_WavPG13)
    if Neigh_all_WavPG13(v,2) <= 500
        Neigh_all_WavPG13(v,3) = 2;
    else
        Neigh_all_WavPG13(v,3) = 1;
    end
end
for v = 1:length(Neigh_all_PGWav13)
    if Neigh_all_PGWav13(v,2) <= 500
        Neigh_all_PGWav13(v,3) = 1;
    else
        Neigh_all_PGWav13(v,3) = 0;
    end
end
ConfusionPGWav13 = [Neigh_all_WavPG13(:,3); zeros(1199,1)];



%trying to make bar graphs for TetPG vs TetWav
FalseNegTet_PG_Wav_19 = [(15/76) (8/47)];
bar(FalseNegTet_PG_Wav_19, 'm');
ylim([0 1])

FalsePosTet_PG_Wav_19 = [(43/76) (14/47)];
bar(FalsePosTet_PG_Wav_19, 'm');
ylim([0 1])

TruePosTet_PG_Wav_19 = [(18/76) (25/47)];
bar(TruePosTet_PG_Wav_19, 'm');
ylim([0 1])

%a 100% stacked bar would be easier to understand than my current stacked bar
PG_100StackedBar = [(15/76) (43/76) (18/76)];
Wav_100StackedBar = [(8/47) (14/47) (25/47)];
PGWav_100StackedBar = [PG_100StackedBar; Wav_100StackedBar];
bar(PGWav_100StackedBar, 'stacked')



%then do this for PGWav19 vs PGWav13

FalseNeg_PG_Wav = [(34/74) (1333/2665)];
bar(FalseNeg_PG_Wav, 'r');
ylim([0 1])

FalsePos_PG_Wav = [(11/74) (1199/2665)];
bar(FalsePos_PG_Wav, 'g');
ylim([0 1])

TruePos_PG_Wav = [(29/74) (135/2665)];
bar(TruePos_PG_Wav, 'b');
ylim([0 1])


%a 100 stacked bar because no one likes pie charts
PW19_100StackedBar = [(34/74) (11/74) (29/74)];
PW13_100StackedBar = [(1331/2665) (1199/2665) (135/2665)];
PW1913_100StackedBar = [PW19_100StackedBar; PW13_100StackedBar];
bar(PW1913_100StackedBar, 'stacked')
ylim([0 1])



%getting rid of all the unclassified clicks
flag = 0;
for v = 1:length(Deleting_Extras)
    if Deleting_Extras(v,2) == 5
        flag = Deleting_Extras(v,1);
        max_sample_PG13 = [max_sample_PG13; flag];
    end
end

%PG Wav stacked bar of match vs no match
Wav_MatchNoMatch = [22 25];
PGWav_MatchNoMatch = [PG_MatchNoMatch; Wav_MatchNoMatch];
bar(PGWav_MatchNoMatch, 'stacked')

%PG Wav Stacked bar with just tetyana detections-- yellow is bad here
PGTetYN = [13 20];
WavTetYN = [8 25];
PGWavYN = [PGTetYN; WavTetYN];
bar(PGWavYN, 'stacked')
ylim([0 33])

%19 13 bar of total unique detections
UniqueDetections_PGWav19 = 74;
UniqueDetections_PGWav13 = 2665;
UniqueDetections_PGWav = [UniqueDetections_PGWav19 UniqueDetections_PGWav13];
bar(UniqueDetections_PGWav)

%a 100 stacked bar because no one likes pie charts
PW19_100StackedBar = [(34/74) (11/74) (29/74)];
PW13_100StackedBar = [(1333/2665) (1199/2665) (135/2665)];
PW1913_100StackedBar = [PW19_100StackedBar; PW13_100StackedBar];
bar(PW1913_100StackedBar, 'stacked')
ylim([0 1])
