-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,381 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
clc; clear; close all; load('all_threshold_perf.mat'); | ||
%% small | ||
warning('off'); | ||
clc; close all; clearvars -except total_AUPRC total_AUROC | ||
n = 6; | ||
|
||
x = linspace(0,5,100); | ||
figure(1); subplot(121); | ||
h = stdshade(total_AUROC(:,1:n)',0.15,'b',x); | ||
xlim([0 5]); | ||
h.LineWidth = 3; | ||
title('AUROC','FontSize',16); | ||
xlabel('\alpha','FontSize',14); | ||
ylabel('AUROC','FontSize',14); | ||
set(gca,'fontsize',14); | ||
|
||
|
||
figure(1);subplot(122); | ||
h = stdshade(total_AUPRC(:,1:n)',0.15,'r',x); | ||
h.LineWidth = 3; | ||
xlim([0 5]); | ||
title('AUPR','FontSize',16); | ||
xlabel('\alpha','FontSize',14); | ||
ylabel('AUPR','FontSize',14); | ||
set(gca,'fontsize',14); | ||
sgt = sgtitle('100 Neurons'); | ||
sgt.FontSize = 20; | ||
sgt.FontWeight = 'bold'; | ||
%% normal | ||
x = linspace(0,5,100); | ||
figure(2); subplot(121); | ||
h = stdshade(total_AUROC(:,n+1:end)',0.15,'b',x); | ||
xlim([0 5]); | ||
h.LineWidth = 3; | ||
title('AUROC','FontSize',16); | ||
xlabel('\alpha','FontSize',14); | ||
ylabel('AUROC','FontSize',14); | ||
set(gca,'fontsize',14); | ||
|
||
|
||
figure(2);subplot(122); | ||
h = stdshade(total_AUPRC(:,n+1:end)',0.15,'r',x); | ||
h.LineWidth = 3; | ||
xlim([0 5]); | ||
title('AUPR','FontSize',16); | ||
xlabel('\alpha','FontSize',14); | ||
ylabel('AUPR','FontSize',14); | ||
set(gca,'fontsize',14); | ||
sgt = sgtitle('1000 Neurons'); | ||
sgt.FontSize = 20; | ||
sgt.FontWeight = 'bold'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
function [lineOut, fillOut] = stdshade(amatrix,alpha,acolor,F,smth) | ||
% usage: stdshading(amatrix,alpha,acolor,F,smth) | ||
% plot mean and sem/std coming from a matrix of data, at which each row is an | ||
% observation. sem/std is shown as shading. | ||
% - acolor defines the used color (default is red) | ||
% - F assignes the used x axis (default is steps of 1). | ||
% - alpha defines transparency of the shading (default is no shading and black mean line) | ||
% - smth defines the smoothing factor (default is no smooth) | ||
% smusall 2010/4/23 | ||
if exist('acolor','var')==0 || isempty(acolor) | ||
acolor='r'; | ||
end | ||
if exist('F','var')==0 || isempty(F) | ||
F=1:size(amatrix,2); | ||
end | ||
if exist('smth','var'); if isempty(smth); smth=1; end | ||
else smth=1; %no smoothing by default | ||
end | ||
if ne(size(F,1),1) | ||
F=F'; | ||
end | ||
amean = nanmean(amatrix,1); %get man over first dimension | ||
if smth > 1 | ||
amean = boxFilter(nanmean(amatrix,1),smth); %use boxfilter to smooth data | ||
end | ||
astd = nanstd(amatrix,[],1); % to get std shading | ||
astd = (astd./sqrt(size(amatrix,1))); % SEM | ||
% astd = nanstd(amatrix,[],1)/sqrt(size(amatrix,1)); % to get sem shading | ||
if exist('alpha','var')==0 || isempty(alpha) | ||
fillOut = fill([F fliplr(F)],[amean+astd fliplr(amean-astd)],acolor,'linestyle','none'); | ||
acolor='k'; | ||
else | ||
fillOut = fill([F fliplr(F)],[amean+astd fliplr(amean-astd)],acolor, 'FaceAlpha', alpha,'linestyle','none'); | ||
end | ||
if ishold==0 | ||
check=true; else check=false; | ||
end | ||
hold on; | ||
lineOut = plot(F,amean,'Color',acolor,'linewidth',1.5); %% change color or linewidth to adjust mean line | ||
if check | ||
hold off; | ||
end | ||
end | ||
function dataOut = boxFilter(dataIn, fWidth) | ||
% apply 1-D boxcar filter for smoothing | ||
fWidth = fWidth - 1 + mod(fWidth,2); %make sure filter length is odd | ||
dataStart = cumsum(dataIn(1:fWidth-2),2); | ||
dataStart = dataStart(1:2:end) ./ (1:2:(fWidth-2)); | ||
dataEnd = cumsum(dataIn(length(dataIn):-1:length(dataIn)-fWidth+3),2); | ||
dataEnd = dataEnd(end:-2:1) ./ (fWidth-2:-2:1); | ||
dataOut = conv(dataIn,ones(fWidth,1)/fWidth,'full'); | ||
dataOut = [dataStart,dataOut(fWidth:end-fWidth+1),dataEnd]; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
clear; clc; close all; | ||
|
||
load('all_perf_eval.mat'); | ||
%% | ||
AUROC_100 = [F_AUROC(1:6,:),S_AUROC(1:6,:)]; | ||
AUROC_1000 = [F_AUROC(7:end,:),S_AUROC(7:end,:)]; | ||
|
||
AUPRC_100 = [F_AUPRC(1:6,:),S_AUPRC(1:6,:)]; | ||
AUPRC_1000 = [F_AUPRC(7:end,:),S_AUPRC(7:end,:)]; | ||
%% | ||
close all; | ||
color = ['b' 'r']; | ||
figure(1); | ||
subplot(1,2,1); | ||
b = boxplot(AUROC_100,'whisker',1000,'Symbol','','Labels',{'FARCI','Sutera et al.'}); ylim([0.7 1]); yticks([0.7 0.8 0.9 1]); box off; | ||
title('100 Neurons','FontSize',14); | ||
uistack(b,'top'); | ||
set(gca,'fontsize',14); | ||
|
||
h = findobj(gca,'Tag','Box'); | ||
for j=1:size(h,1) | ||
patch(get(h(j),'XData'),get(h(j),'YData'),color(j),'FaceAlpha',.5); | ||
uistack(h(j),'top'); | ||
end | ||
|
||
|
||
hAx=gca; % retrieve the axes handle | ||
xtk=hAx.XTick; | ||
hold on | ||
for i = 1:6 | ||
|
||
a = plot(xtk,AUROC_100(i,:),'--','Color',[0.75 0.75 0.75]); | ||
|
||
end | ||
|
||
uistack(b,'top'); | ||
subplot(1,2,2); | ||
b = boxplot(AUROC_1000,'whisker',1000,'Symbol','','Labels',{'FARCI','Sutera et al.'}); ylim([0.7 1]); box off; set(gca,'ytick',[]); | ||
title('1000 Neurons','FontSize',14); | ||
set(gca,'fontsize',14); | ||
|
||
h = findobj(gca,'Tag','Box'); | ||
for j=1:size(h,1) | ||
patch(get(h(j),'XData'),get(h(j),'YData'),color(j),'FaceAlpha',.5); | ||
end | ||
|
||
hAx=gca; % retrieve the axes handle | ||
xtk=hAx.XTick; | ||
hold on | ||
for i = 1:10 | ||
|
||
a = plot(xtk,AUROC_1000(i,:),'--','Color',[0.75 0.75 0.75]); | ||
% uistack(a,'bottom'); | ||
end | ||
|
||
ha=get(gcf,'Children'); | ||
|
||
set(ha(1),'position',[0.5 0.1 0.4 0.8]); | ||
set(ha(2),'position',[0.1 0.1 0.4 0.8]); | ||
uistack(ha(1),'top'); | ||
sgtitle('AUROC'); | ||
%% | ||
|
||
figure(2); | ||
subplot(1,2,1); | ||
boxplot(AUPRC_100,'whisker',1000,'Symbol','','Labels',{'FARCI','Sutera et al.'}); ylim([0.2 1]); box off; | ||
title('100 Neurons','FontSize',16); | ||
set(gca,'fontsize',14); | ||
|
||
h = findobj(gca,'Tag','Box'); | ||
for j=1:size(h,1) | ||
patch(get(h(j),'XData'),get(h(j),'YData'),color(j),'FaceAlpha',.5); | ||
end | ||
|
||
hAx=gca; % retrieve the axes handle | ||
xtk=hAx.XTick; | ||
hold on | ||
for i = 1:6 | ||
|
||
plot(xtk,AUPRC_100(i,:),'--','Color',[0.75 0.75 0.75]); | ||
|
||
end | ||
|
||
subplot(1,2,2); | ||
boxplot(AUPRC_1000,'whisker',1000,'Symbol','','Labels',{'FARCI','Sutera et al.'}); ylim([0.2 1]); box off; set(gca,'ytick',[]); | ||
title('1000 Neurons','FontSize',16); | ||
set(gca,'fontsize',14); | ||
|
||
h = findobj(gca,'Tag','Box'); | ||
for j=1:size(h,1) | ||
patch(get(h(j),'XData'),get(h(j),'YData'),color(j),'FaceAlpha',.5); | ||
end | ||
|
||
hAx=gca; % retrieve the axes handle | ||
xtk=hAx.XTick; | ||
hold on | ||
for i = 1:10 | ||
|
||
plot(xtk,AUPRC_1000(i,:),'--','Color',[0.75 0.75 0.75]); | ||
|
||
end | ||
|
||
ha=get(gcf,'Children'); | ||
set(ha(1),'position',[0.5 0.1 0.4 0.8]); | ||
set(ha(2),'position',[0.1 0.1 0.4 0.8]); | ||
|
||
sgtitle('AUPR'); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
clear; clc; close all; | ||
|
||
load('subsampling_results (normal1).mat'); | ||
%% AUROC | ||
x = sub_size; | ||
y1 = F_AUROC; | ||
figure; | ||
xi = linspace(min(x), max(x), 150); | ||
yi = interp1(x, y1, xi, 'spline', 'extrap'); | ||
p1 = plot(xi, yi, 'LineWidth',3); | ||
hold on | ||
xticks([200 400 600 800 1000]); | ||
|
||
% | ||
|
||
y2 = S_AUROC; | ||
|
||
xi = linspace(min(x), max(x), 150); | ||
yi = interp1(x, y2, xi, 'spline', 'extrap'); | ||
p2 = plot(xi, yi,'--', 'LineWidth',3); | ||
|
||
|
||
hold on | ||
% errorbar(x,y1,F_AUROC_err,'.','Color','k'); | ||
% errorbar(x,y2,F_AUROC_err,'.','Color','k'); | ||
% | ||
|
||
plot(x, y2, 'o','MarkerEdgeColor',p2.Color,'MarkerFaceColor',p2.Color,'MarkerSize',8); | ||
plot(x, y1, 'o','MarkerEdgeColor',p1.Color,'MarkerFaceColor',p1.Color,'MarkerSize',8); | ||
|
||
title('AUROC','FontSize',16); | ||
xlabel('Number of subsampled neurons','FontSize',14); | ||
ylabel('AUROC','FontSize',14); | ||
set(gca,'fontsize',14); | ||
L = legend('FARCI','Sutera et al. (2015)','FontSize',14,'Location','southeast'); | ||
set(L,'Box','off'); | ||
|
||
%% AUPRC | ||
x = sub_size; | ||
y1 = F_AUPRC; | ||
figure; | ||
xi = linspace(min(x), max(x), 150); | ||
yi = interp1(x, y1, xi, 'spline', 'extrap'); | ||
p1 = plot(xi, yi, 'LineWidth',3); | ||
hold on | ||
xticks([200 400 600 800 1000]); | ||
yticks([0.2 0.3 0.4 0.5]); | ||
|
||
% | ||
|
||
y2 = S_AUPRC; | ||
|
||
xi = linspace(min(x), max(x), 150); | ||
yi = interp1(x, y2, xi, 'spline', 'extrap'); | ||
p2 = plot(xi, yi,'--', 'LineWidth',3); | ||
|
||
|
||
hold on | ||
% errorbar(x,y1,F_AUPRC_err,'.','Color','k'); | ||
% errorbar(x,y2,F_AUPRC_err,'.','Color','k'); | ||
% | ||
|
||
plot(x, y2, 'o','MarkerEdgeColor',p2.Color,'MarkerFaceColor',p2.Color,'MarkerSize',8); | ||
plot(x, y1, 'o','MarkerEdgeColor',p1.Color,'MarkerFaceColor',p1.Color,'MarkerSize',8); | ||
|
||
title('AUPR','FontSize',16); | ||
xlabel('Number of subsampled neurons','FontSize',14); | ||
ylabel('AUPR','FontSize',14); | ||
set(gca,'fontsize',14); | ||
L = legend('FARCI','Sutera et al. (2015)','FontSize',14,'Location','southeast'); | ||
set(L,'Box','off'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
clear; clc; close all; | ||
addpath('all_subsamplings'); | ||
%% AUROC | ||
clc; close all; clear; | ||
x = [50 200 400 600 800 1000]; | ||
y = []; | ||
y1_all = []; | ||
z = []; | ||
for i = 1:10 | ||
filename = strcat('Normal',num2str(i)); | ||
load(filename); | ||
|
||
y1 = mean(total_AUROC,2); | ||
y1 = y1(end:-1:1); | ||
xi = linspace(min(x), max(x), 950); | ||
% yi = interp1(x, y1, xi, 'spline', 'extrap'); | ||
yi = interp1(x, y1, xi,'pchip'); | ||
y = [y, yi']; | ||
y1_all = [y1_all,y1]; | ||
z = [z, total_AUROC]; | ||
end | ||
y1_all = y1_all'; | ||
labels = {'50';'200';'400';'600';'800';'1000'}; | ||
|
||
figure(1); | ||
ax = violinplot(y1_all,labels); | ||
title('AUROC','FontSize',16); | ||
xlabel('Number of subsampled neurons','FontSize',14); | ||
ylabel('AUROC','FontSize',14); | ||
set(gca,'fontsize',14); | ||
box on | ||
%% AUPR | ||
clc; close all; clear; | ||
x = [50 200 400 600 800 1000]; | ||
y = []; | ||
y1_all = []; | ||
for i = 1:10 | ||
filename = strcat('Normal',num2str(i)); | ||
load(filename); | ||
|
||
y1 = mean(total_AUPRC,2); | ||
y1 = y1(end:-1:1); | ||
xi = linspace(min(x), max(x), 950); | ||
% yi = interp1(x, y1, xi, 'spline', 'extrap'); | ||
yi = interp1(x, y1, xi,'pchip'); | ||
y = [y, yi']; | ||
y1_all = [y1_all,y1]; | ||
|
||
end | ||
y1_all = y1_all'; | ||
labels = {'50';'200';'400';'600';'800';'1000'}; | ||
|
||
figure(2); | ||
ax = violinplot(y1_all,labels); | ||
title('AUPR','FontSize',16); | ||
xlabel('Number of subsampled neurons','FontSize',14); | ||
ylabel('AUPR','FontSize',14); | ||
set(gca,'fontsize',14); | ||
box on |
Oops, something went wrong.