Neural Network
Generic Neural Network for Classification
network.h
Go to the documentation of this file.
1 
8 #ifndef NETWORK_H
9 #define NETWORK_H
10 
11 #include <vector>
12 #include <iostream>
13 #include <fstream>
14 #include <string>
15 #include "layer.h"
16 
23 class Network {
24  public:
26  Network(int _num_layers, int _input_unit, int _layer_unit, int _output_unit);
27  matrix* affine_forward(matrix* a, Layer* layer);
28  matrix* relu_forward(matrix* z);
29  matrix* cross_entropy(matrix* f, matrix* a);
30  void** affine_backward(matrix* df, matrix* a, Layer* layer);
31  matrix* relu_backward(matrix* df, matrix* a_prev);
32  int import_data(std::string filename);
33  int train_network();
34  void test();
35  private:
36  double _update_layers(matrix* current_batch);
37  double _calculate_accuracy(matrix* confusion_matrix);
38  matrix* _build_confusion_matrix(matrix* f, matrix* current_batch);
39 
40  std::vector<Layer*>* _layers;
41  std::vector<std::vector<double>>* _training_data;
42  int _num_layers;
43  int _input_unit;
44  int _layer_unit;
45  int _output_unit;
46  int _EPOCH = 100;
47  int _WEIGHT_SCALE = 0.01;
48  int _BATCH_SIZE = 128;
49  int _POLICY_SIZE = 10000;
50  double _LEARNING_RATE = 0.1;
51  matrix* _confusion_matrix;
53  int _init_network();
54 };
55 
56 #endif
represents a matrix between matrix and vector they are able to be casted into one another ...
Definition: linalg.h:49
Layer object the layer object contains nodes.
Definition: layer.h:22
header file for layer object
Network object the network object acts as a layer between the user and the input,hidden, and output layers.
Definition: network.h:23
Network(int _num_layers, int _input_unit, int _layer_unit, int _output_unit)
Constructor that calls _init_network.
Definition: network.cpp:10