-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathNetworkFactory.m
52 lines (40 loc) · 1.74 KB
/
NetworkFactory.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
41
42
43
44
45
46
47
48
49
50
51
classdef NetworkFactory
% A factory to initialise the network to be used within an ARTwarp run.
% Detailed explanation goes here
methods (Static)
function net = new_network(contours)
% Creates an empty network
weights = ones(max([contours.length]), 0);
net = Network(weights);
end
function load_network
% Load a saved network
% TODO: no idea how we would store networks
end
function net = run_categorisation(network, contours, parameters)
% This will run the network until all contours have been
% categorised and an iteration has completed with no reclassifications
% NOTE: contour list should be randomised before entered into this function
network.reclassifications = 0;
iteration_number = 1;
a = 0;
while(a == 0 && iteration_number < parameters.maxNumIterations)
% Set the number of reclassifications for the iteration to
% zero
network.reclassifications = 0;
% Run through this iteration, updating the network with each contour in the list
for i = 1:length(contours)
network = network.update_network(contours(i), parameters);
end
% Increment iteration number
iteration_number = iteration_number + 1;
% Break out of loop if no reclassifications done (categorisation complete)
if network.reclassifications == 0
a = 1;
end
end
% assign net as completed network
net = network;
end
end
end