20 #ifndef SUPERNN_NETWORK_HPP
21 #define SUPERNN_NETWORK_HPP
26 #include "activation_type.hpp"
36 struct SUPERNN_EXPORT
Layer :
public std::vector<Neuron>
46 void add_neuron(
Neuron &n);
54 void add_neurons(
unsigned n_neurons,
bool bias =
false);
63 void set_activation(
ActFuncType type,
double s = 1);
71 void connect(
unsigned to_layer,
unsigned to_neuron);
89 static Network make_mlp(
unsigned input,
unsigned hidden,
unsigned output);
99 static Network make_mlp(
unsigned input,
unsigned output);
111 static Network make_mlp(
unsigned input,
unsigned hidden1,
unsigned hidden2,
unsigned output);
121 static Network make_fcc(
unsigned input,
unsigned hidden,
unsigned output);
131 void add_layer(
Layer &l);
138 void add_layers(
unsigned n_layers);
148 const Row &run(
const Row &in,
bool calc_error =
false);
157 double calc_mse(
const Data &data);
166 double calc_mae(
const Data &data);
177 double calc_class(
const Data &data,
double limit = 0.5);
188 double calc_class_higher(
const Data &data);
196 void init_weights(
double min = -0.5,
double max = 0.5);
205 void set_activation(
ActFuncType type,
double s = 1);
213 void save_file(
const std::string &path)
const;
221 void load_file(
const std::string &path);
230 void connect(
unsigned from_layer,
unsigned to_layer);
239 void connect_neuron_to_layer(
unsigned from_layer,
unsigned from_neuron,
unsigned to_layer);
247 void clear_neurons(
bool clear_delta,
bool clear_run);
254 unsigned calc_num_weights()
const;
261 unsigned calc_num_neurons()
const;
266 unsigned calc_num_inputs()
const;
274 const Layer &operator[](
unsigned l)
const;
282 Layer &operator[](
unsigned l);
289 unsigned size()
const;
Neuron, that can contain connections to neurons in the next layers.
std::vector< Layer > layers
Neuron layers.
unsigned n_input
Last computed number of neurons in the input layer that aren't biases, computed by run()...
Artificial neural network structure that supports arbitrary feedforward topologies, like multilayer perceptrons and fully connected cascade networks.
ActFuncType
Activation functions built-in in the library.
std::vector< double > Row
Data row.
Row last_output
Structure that holds the last output values.
Data used in training, validation and testing.