# Deep network: src/network.hpp Source File

network.hpp
Go to the documentation of this file.
#ifndef NETWORK_HPP
#define NETWORK_HPP
#include <random>
#include <list>
#include "layers/layer.hpp"
#include "dataset.hpp"
enum CostFunction{CrossEntropy,Quadratic};
class Network{
public:
list<Layer::Layer*> layers;
size_t n_in;
size_t n_out;
Vector a;
Vector last_delta;
CostFunction C;
void compute_last_delta(Vector y);
protected:
void shuffle(size_t* tab,size_t size);
void update_batch(Dataset* dataset,size_t* indices,size_t begin,size_t end,Real eta);
void back_propagation(Vector x,Vector y,Real eta);
public:
Network();
void set_cost(CostFunction);
void push_layer(Layer::Layer& l);
void is_done();
Vector feed_forward(Vector x_in);
Real eval(Dataset *dataset);
void train(Dataset* dataset,size_t nb_epochs,size_t batch_size,Real eta);
};
inline void
Network::set_cost(CostFunction C_){
C=C_;
}
#endif
Dataset
Definition: dataset.hpp:9
Layer::Layer
Definition: layer.hpp:20
Network
Definition: network.hpp:12
Network::eval
Real eval(Dataset *dataset)
Definition: network.cpp:38
Network::update_batch
void update_batch(Dataset *dataset, size_t *indices, size_t begin, size_t end, Real eta)
Definition: network.cpp:84
Network::is_done
void is_done()
Definition: network.cpp:22
Network::Network
Network()
Definition: network.cpp:3
Network::n_out
size_t n_out
Definition: network.hpp:16
Network::layers
list< Layer::Layer * > layers
Definition: network.hpp:14
Network::back_propagation
void back_propagation(Vector x, Vector y, Real eta)
Definition: network.cpp:101
Network::compute_last_delta
void compute_last_delta(Vector y)
Definition: network.cpp:115
Network::set_cost
void set_cost(CostFunction)
Definition: network.hpp:36
Network::train
void train(Dataset *dataset, size_t nb_epochs, size_t batch_size, Real eta)
Definition: network.cpp:63
Network::last_delta
Vector last_delta
Definition: network.hpp:18
Network::n_in
size_t n_in
Definition: network.hpp:15
Network::shuffle
void shuffle(size_t *tab, size_t size)
Definition: network.cpp:52
Network::feed_forward
Vector feed_forward(Vector x_in)
Definition: network.cpp:27
Network::C
CostFunction C
Definition: network.hpp:19
Network::a
Vector a
Definition: network.hpp:17
Network::push_layer
void push_layer(Layer::Layer &l)
Definition: network.cpp:8
dataset.hpp
layer.hpp
CostFunction
CostFunction
Definition: network.hpp:10
Quadratic
@ Quadratic
Definition: network.hpp:10
CrossEntropy
@ CrossEntropy
Definition: network.hpp:10
Real
double Real
Definition: vector.hpp:9
Vector
Real * Vector
Definition: vector.hpp:45