-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
59 lines (45 loc) · 1000 Bytes
/
main.cpp
File metadata and controls
59 lines (45 loc) · 1000 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include<iostream>
#include "MatrixFlow.h"
#include "Matrix.h"
int main(){
// inputs
Matrix X(4, 2);
X.data = {
0, 0,
1, 0,
0, 1,
1, 1
};
Matrix Y(4, 1);
Y.data = {
0,
1,
1,
0
};
// model architecture
// Sequential model({
// new Dense(2, 5),
// new ReLU(),
// new Dense(5,10),
// new ReLU(),
// new Dense(10, 5),
// new ReLU(),
// new Dense(5, 1),
// new Sigmoid()
// });
Sequential model;
model.add(new Dense(2, 10));
model.add(new ReLU());
model.add(new Dense(10, 1));
model.add(new Sigmoid());
// trainer
Trainer trainer(model, X, Y, 10000, 4, 0.1, 1000);
// training
std::cout << "------ Training Started ------" << std::endl;
trainer.train();
std::cout << "------ Training Complete ------" << std::endl;
// prediction
model.forward(X).print();
return 0;
}