Skip to content

Commit 43f3ceb

Browse files
committed
fix demo
1 parent 091f34b commit 43f3ceb

File tree

2 files changed

+38
-30
lines changed

2 files changed

+38
-30
lines changed

results/demo/demo.m renamed to demo.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function demo(mode,varargin)
44
user_path = initialization;
55

66
%% Terminal Mode
7-
% No GUI elements
7+
% No GUI elements --> UDER DEVELOPMENT
88
if mode == 0
99
flag = 1;
1010
disp('Generating original results...');

results/demo/demo_gui.m

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ function demo_gui(set,user_path)
9090

9191
%% Results
9292
groups = [1,2];
93+
load(fullfile(project_path,'segmentation',seg_name{1}));
9394
[exit, animals_trajectories_map] = trajectories_map(segmentation_configs,groups,'Friedman',set);
9495

9596
% METRICS
96-
groups = [1,2];
9797
str = num2str(groups);
9898
str = regexprep(str,'[^\w'']',''); %remove gaps
9999
str = strcat('group',str);
@@ -107,33 +107,30 @@ function demo_gui(set,user_path)
107107
errordlg('Error: metrics generation','Error');
108108
end
109109

110-
% STATISTICS
111-
[error,~,~] = class_statistics(project_path, class_name);
112-
if error
113-
errordlg('Error: statistics generation','Error');
114-
end
115-
116-
% STRATEGIES - TRANSITIONS - PROBABILITIES
110+
% STRATEGIES - TRANSITIONS - PROBABILITIES - STATISTICS
117111
b_pressed = {'Strategies','Transitions','Probabilities'};
118112
class = {'class_1301_10388_250_07_10_10_mr0-tiago','class_1657_29476_250_09_10_10_mr0-tiago'};
119113
for j = 1:length(seg_name)
120-
%check if everything is ok
114+
115+
% Check if everything is ok
121116
if ~exist(fullfile(project_path,'Mclassification',class{j}),'file')
122117
errordlg('Check fail for results: strategies, transitions and probabilities','Error');
123118
return
124-
end
125-
% Generate the animals_trajectories_map
126-
load(fullfile(project_path,'segmentation',seg_name{j}));
127-
if exit
128-
errordlg('Cannot create the animals_trajectories_map','Error');
129-
return
130-
end
119+
end
120+
121+
% Statistics
122+
[error,~,~] = class_statistics(project_path, class{j});
123+
if error
124+
errordlg('Error: statistics generation','Error');
125+
end
126+
131127
% Check the classification
132128
[error,name,classifications] = check_classification(project_path,segmentation_configs,class{j});
133129
if error
134130
errordlg('Classification check failed','Error');
135131
return
136132
end
133+
137134
% Generate the results
138135
for i = 1:length(b_pressed)
139136
error = generate_results(project_path, name, segmentation_configs, classifications, animals_trajectories_map, b_pressed{i}, groups);
@@ -145,18 +142,29 @@ function demo_gui(set,user_path)
145142
end
146143

147144
%% Labelling Quality
148-
% [nc,res1bare,res2bare,res1,res2,res3,covering] = results_clustering_parameters(segmentation_configs,labels,0,output_path,10,100,1);
149-
% output_path = char(fullfile(project_path,'results',strcat(p,'_cross_validation')));
150-
% if exist(output_path,'dir');
151-
% rmdir(output_path,'s');
152-
% end
153-
% mkdir(output_path);
154-
% [nc,per_errors1,per_undefined1,coverage] = algorithm_statistics(1,1,nc,res1bare,res2bare,res1,res2,res3,covering);
155-
% data = [nc', per_errors1', per_undefined1', coverage'];
156-
% % export results to CSV file
157-
% export_num_of_clusters(output_path,data);
158-
% % generate graphs
159-
% results_clustering_parameters_graphs(output_path,nc,res1bare,res2bare,res1,res2,res3,covering);
160-
% set(temp(idx),'Visible','on');
145+
files = {'labels_1301_250_07-tiago.mat','labels_1657_250_09-tiago.mat'};
146+
for i = 1:2
147+
load(fullfile(project_path,'segmentation',seg_name{i}));
148+
load(fullfile(project_path,'labels',files{i}));
149+
150+
p = strsplit(files{i},'.mat');
151+
p = p{1};
152+
output_path = char(fullfile(project_path,'labels',strcat(p,'_check')));
153+
if ~exist(output_path,'dir')
154+
mkdir(output_path);
155+
end
156+
[nc,res1bare,res2bare,res1,res2,res3,covering] = results_clustering_parameters(segmentation_configs,labels,0,output_path,10,100,1);
157+
output_path = char(fullfile(project_path,'results',strcat(p,'_cross_validation')));
158+
if exist(output_path,'dir');
159+
rmdir(output_path,'s');
160+
end
161+
mkdir(output_path);
162+
[nc,per_errors1,per_undefined1,coverage] = algorithm_statistics(1,1,nc,res1bare,res2bare,res1,res2,res3,covering);
163+
data = [nc', per_errors1', per_undefined1', coverage'];
164+
% export results to CSV file
165+
export_num_of_clusters(output_path,data);
166+
% generate graphs
167+
results_clustering_parameters_graphs(output_path,nc,res1bare,res2bare,res1,res2,res3,covering);
168+
end
161169
end
162170

0 commit comments

Comments
 (0)