-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathANNLAB.cpp
70 lines (63 loc) · 2.55 KB
/
ANNLAB.cpp
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
//#include <iterator>
#include "ANNLAB.h"
#include "UserInterface.h"
#include "NeuralNet.h"
//#include "NetworkArchitecture.h"
#include "FeedforwardArchitecture.h"
//using namespace std;
int main()
{
//NeuralNet ActiveNeuralNet; // Currently selected neural network
// FeedforwardArchitecture A;
vector<string> ArchitectureCatalogue;
ArchitectureCatalogue.push_back("1. Feedforward");
int Architecture = 0;
cout << "Select neural network architecture by entering corresponding integer:" << endl;
for(uint i = 0; i < ArchitectureCatalogue.size(); i++)
{
cout << ArchitectureCatalogue[i] << endl;
}
Architecture = GetIntegerInput(1, ArchitectureCatalogue.size());
cout << endl << ArchitectureCatalogue[Architecture-1] << " architecture selected." << endl;
switch (Architecture)
{
case 1:
{
// Create an instance of class FeedforwardNeuralNet
//FeedforwardArchitecture A;
//NetworkArchitecture<FeedforwardArchitecture> A;
NeuralNet<FeedforwardArchitecture> ActiveNeuralNet;
//ActiveNeuralNet.SetArchitecture(A);
//ActiveNeuralNet.Architecture.InitializeConnections();
ActiveNeuralNet.Architecture.InitializeLayers();
ActiveNeuralNet.Architecture.InitializeConnections();
// Arbitrarily set input
ActiveNeuralNet.Architecture.InputLayer.Nodes[0].NodeValue = 1;
ActiveNeuralNet.Architecture.InputLayer.Nodes[1].NodeValue = 1;
// Instantiate connections
for(int i = 0; i < ActiveNeuralNet.Architecture.OutputLayer.Nodes.size(); i++)
{
for(int j = 0; j < ActiveNeuralNet.Architecture.HiddenLayers[0].Nodes.size(); j++)
{
if(j == 1)
ActiveNeuralNet.Architecture.HiddenLayers[0].Nodes[j].Connections.push_back(-2);
else
ActiveNeuralNet.Architecture.HiddenLayers[0].Nodes[j].Connections.push_back(1);
}
}
for(int i = 0; i < ActiveNeuralNet.Architecture.HiddenLayers[0].Nodes.size(); i++)
{
for(int j = 0; j < ActiveNeuralNet.Architecture.InputLayer.Nodes.size(); j++)
{
ActiveNeuralNet.Architecture.InputLayer.Nodes[j].Connections.push_back(1);
}
}
ActiveNeuralNet.PropagateForward();
break;
}
default:
break;
}
cin.ignore();
return 0;
}