-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.m
40 lines (32 loc) · 1.39 KB
/
demo.m
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
%% DEMO for Heterogeneous Activation NEAT
% The algorithm and data configuration are loaded, with the data being
% partitioned into k folds. The algorithm is executed and data collected.
% Configuration and results are saved in a Matlab binary (.mat)
% Algorithm can be run in headless mode
% Author: Alexander Hagg
% Bonn-Rhein-Sieg University of Applied Sciences (HBRS)
% email: [email protected]
% Jan 2017; Last revision: 30-Mar-2017
clear; clc; set(0,'DefaultFigureWindowStyle','docked');
algo = default_params;
results = [];
algo.num_replicates = 2;
algo.headless = true;
% Datasets: data_cancer, data_cholesterol, data_engine
algo.data = get_folds(data_cancer, 3); % Set number of validation folds
disp(['Dataset: ' algo.data.name]);
for rep = 1:algo.num_replicates
disp(['=== Replicate ' int2str(rep) '===']);
for partition = 1:algo.data.num_partitions
disp(['Training partition ' int2str(partition)]);
algo.current_run = partition;
[pop, run_data] = run_neat(algo);
results = collect_data(rep,partition,run_data,algo,results);
save(algo.data.name,'results','algo','-v7.3');
end
end
%% Visualize all folds of all runs
figure(999)
semilogy(results.test_error','LineWidth',2);
grid on;xlabel('Generations');ylabel('MSE');
axis([0 algo.maxGen 1e-2 1e0]);