forked from IPL-UV/simpleR
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathanalyzeModels.m
More file actions
78 lines (65 loc) · 1.75 KB
/
analyzeModels.m
File metadata and controls
78 lines (65 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
%
% Analysis of the models stored in RESULTS/results.mat
%
% Gustau Camps-Valls, 2016(c)
% gustau.camps@uv.es
%
clear;clc;close all;
%% SETUP of FIGURES
fontname = 'AvantGarde';
fontsize = 16;
fontunits = 'points';
set(0,'DefaultAxesFontName',fontname,'DefaultAxesFontSize',fontsize,'DefaultAxesFontUnits',fontunits,...
'DefaultTextFontName',fontname,'DefaultTextFontSize',fontsize,'DefaultTextFontUnits',fontunits,...
'DefaultLineLineWidth',2,'DefaultLineMarkerSize',10,'DefaultLineColor',[0 0 0]);
rand('seed',1234)
randn('seed',1234)
%% LOAD RESULTS
load('RESULTS/results.mat')
d = size(Xtest,2);
numMethods = length(METHODS);
for m = 1:numMethods
model = MODELS{m};
% 1- feature ranking with a permutation analysis
prank = permutation(METHODS{m},model,Xtest,Ytest);
MRANK(m,:) = mean(prank);
SRANK(m,:) = std(prank);
% 2- Partial plots
[XPLOTS(m,:,:) PPLOTS(m,:,:)] = partialplots(METHODS{m},model,Xtest);
end
%% Permutation analysis
figure,
bar(MRANK)
ylabel('Relevance'),xlabel('Methods')
title('RMSE Permutation analysis')
set(gca,'XtickLabel',METHODS)
grid
%% Partial plots for all methods
% figure,
% g = round(sqrt(d));
% for i=1:d
% for m=1:numMethods
% subplot(g,g,i),
% plot(squeeze(XPLOTS(m,i,:)),squeeze(PPLOTS(m,i,:)),'color',[1/m,0,0])
% hold on,
% ylabel('\Delta y'),
% xlabel(VARIABLES{i})
% grid
% drawnow
% end
% end
% legend(METHODS)
%% Partial plots for the first model only
figure,
g = round(sqrt(d));
for i=1:d
for m=1%:numMethods
subplot(g,g,i),
plot(squeeze(XPLOTS(m,i,:)),squeeze(PPLOTS(m,i,:)),'color',[1/m,0,0])
hold on,
ylabel('\Delta y'),
xlabel(VARIABLES{i})
grid
drawnow
end
end