-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathplots_generation.m
More file actions
131 lines (113 loc) · 3.28 KB
/
plots_generation.m
File metadata and controls
131 lines (113 loc) · 3.28 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
%% Computational Intelligence Project 2016
% Activity recognition using fuzzy classifiers.
%
% A.Y.: 2016/2017
% Authors: Paolo Sassi - Matteo Rotundo
%
% Script for plots extraction.
%
%--------------------------------------------------------------------------
clearvars; clc; close all;
% Load the workspace.
load('project_workspace');
%% Signal plots
% Original signal.
plot(timestamps{1}(:,11),sensor_raw{1,1}(:,11));
hold on;
plot(timestamps{1}(:,11),sensor{1,1}(:,11));
%% GA plots
% Independent datasets.
for i=1:3
figure;
plot(pat_nets{i,2}.gen,pat_nets{i,2}.mean,'.b');
hold on;
plot(pat_nets{i,2}.gen,pat_nets{i,2}.best,'.k');
legend('Mean','Best');
xlabel('Generations');
ylabel('Fitness fcn value');
title(['Features selection for sensor ' num2str(i) ' using GA']);
end;
% Union of sensor data.
figure;
plot(pat_union_nets{1,2}.gen,pat_union_nets{1,2}.mean,'.b');
hold on;
plot(pat_union_nets{1,2}.gen,pat_union_nets{1,2}.best,'.k');
legend('Mean','Best');
xlabel('Generations');
ylabel('Fitness fcn value');
title('Features selection for union of sensor data using GA');
%% Sugeno FIS 1 vs. All Plots
for i=1:4
% Cheking error.
figure;
plot(sugeno_fis{1}{i,2}.chkErr);
title(['Sugeno FIS Checking Error Activity ' num2str(i) ' vs. All']);
xlabel('Epoch');
ylabel('Error');
% Training error.
figure;
plot(sugeno_fis{1}{i,2}.error);
title(['Sugeno FIS Training Error Activity ' num2str(i) ' vs. All']);
xlabel('Epoch');
ylabel('Error');
% Testing error.
figure;
plot(sugeno_outputs{1}{i,1}, '*r');
title(['Sugeno FIS Output Error Activity ' num2str(i) ' vs. All']);
xlabel('Input Number');
ylabel('Value');
hold on;
plot(anfis_test{1,i}(:,5), 'ob');
plot(sugeno_outputs{1}{i,2}, 'xk');
legend('FIS output', 'Target', 'Filtered output');
end;
%% Sugeno FIS All vs. All Plots
figure;
plot(sugeno_fis{1}{5,2}.chkErr);
title('Sugeno FIS Checking Error Four-Class');
xlabel('Epoch');
ylabel('Error');
% Training error.
figure;
plot(sugeno_fis{1}{5,2}.error);
title('Sugeno FIS Training Error Four-Class');
xlabel('Epoch');
ylabel('Error');
% Testing error.
figure;
plot(sugeno_outputs{1}{5,1}, '*r');
title('Sugeno FIS Output Error Four-Class');
xlabel('Input Number');
ylabel('Value');
hold on;
plot(anfis_test{1,5}(:,5), 'ob');
plot(sugeno_outputs{1}{5,2}, 'xk');
legend('FIS output', 'Target', 'Filtered output');
%% Plot features
% It is possible to plot different features change the feat variable.
% It is also possible to plot with different intervals of time changing
% the variable window.
feat_temp = features_raw;
window = 1;
feat = 5;
label = 1;
for sensor=2:3
features1 = add_label(feat_temp{feat, 1}{window, sensor}, label);
plot(features1(1,1), features1(2,1));
hold on
grid on
for i=1:length(features1)
if (features1(2,i) == 1)
plot(features1(1,i), features1(2,i), 'k*');
end;
if (features1(2,i) == 2)
plot(features1(1,i), features1(2,i), 'bo');
end;
if (features1(2,i) == 3)
plot(features1(1,i), features1(2,i), 'gx');
end;
if (features1(2,i) == 4)
plot(features1(1,i), features1(2,i), 'rs');
end;
end;
end;