A slightly better neural network. More...
#include <neuralnetwork.h>
Public Member Functions | |
NeuralNetwork (std::string file="") | |
Loads a neural network from a file if specified. | |
void | reset (std::vector< int > geometry) |
Creates a fresh network with given input and hidden layer sizes) The output layer is always a single neuron). geometry[i] stores the size of the ith layer (not counting the bias unit) The last integer is the size of the last hidden layer. | |
bool | fromFile (std::string file) |
Loads a network from a file. Returns true if it succeded. | |
bool | toFile (std::string file) |
Save the current network to a file. | |
double | train (Corpus &c, double rate, double regularization, int nbIter, bool debug=false) |
Train the network on a corpus. | |
double | classify (std::vector< double > input) |
Get the output of the network on a given input. | |
double | accuracy (Corpus &c) |
See how well the network does on a given corpus (between 0, not accurate, and 1, accurate) | |
void | randomize () |
Randomize the weights of the network. | |
unsigned int | nbLayers () |
Parameters. | |
unsigned int | dimension () |
Input dimension of the network (size of the input layer) |
Friends | |
class | boost::serialization::access |
Internal usage : for load and save. |
A slightly better neural network.
unsigned int NeuralNetwork::dimension | ( | ) |
Input dimension of the network (size of the input layer)
Return the input dimension of the network.
|
inline |
Parameters.
Number of layers of the network (hidden layers + output layer)
void NeuralNetwork::reset | ( | std::vector< int > | geometry | ) |
Creates a fresh network with given input and hidden layer sizes) The output layer is always a single neuron). geometry[i] stores the size of the ith layer (not counting the bias unit) The last integer is the size of the last hidden layer.
Creates a fresh network with given input and hidden layer sizes (the output layer is always a single neuron)