-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (31 loc) · 804 Bytes
/
main.cpp
File metadata and controls
36 lines (31 loc) · 804 Bytes
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
#include"data/data_retrieval.h"
#include"simple_network/simple_network.h"
#include<iostream>
int main(){
DataRetriever dr("data/training");
DataRetriever testdr("data/testing");
SimpleNetwork sn;
sn.setEta(0.5);
sn.setTrainingBatchSize(10);
sn.setTrainingData(&dr);
sn.initialize(200);
for(int i=0;i!=100;i++){
dr.setIndex(0);
for(int trainj=0; trainj!=5000; trainj++){
sn.train();
}
testdr.setIndex(0);
int num_of_correct = 0;
for(int testj=0; testj!=10000; testj++){
Data testdata = testdr.getData();
if(sn.perceive(&testdata) == testdata.getLabel()){
num_of_correct ++;
}
testdr.next();
}
cout << "epoch " << i << " : "
<< "Testing accuracy " << (float)num_of_correct /10000*100
<< "%" << endl;
}
return 0;
}