SuperNN  1.0.0
Public Member Functions | Public Attributes | List of all members
SuperNN::Runner Struct Reference

Auxiliary class to ease the usage of an already trained neural network. More...

Public Member Functions

 Runner (const std::string &net_path, const std::string &info_path)
 Constructor. More...
 
 Runner ()
 
virtual ~Runner ()
 
double & inp (unsigned idx)
 Accessor to get/set an input value. More...
 
void load_info_file (const std::string &info_path)
 Loads the bounds info file. More...
 
double out (unsigned idx)
 Accessor to get an output value. More...
 
void run ()
 Runs the network with the current input setted by inp(). More...
 
void set_bounds (Bounds &from, Bounds &to)
 Sets the bounds from already built Bound objects. More...
 

Public Attributes

Data inp_data
 
Network net
 
Data out_data
 

Detailed Description

Auxiliary class to ease the usage of an already trained neural network.

It handles the input, scaling, running and descaling operations.

Definition at line 36 of file runner.hpp.

Constructor & Destructor Documentation

SuperNN::Runner::Runner ( const std::string &  net_path,
const std::string &  info_path 
)

Constructor.

Parameters
net_pathPath to the neural network file
info_pathPath to the scaling info file
Exceptions
ErrorTypeif the input files couldn't be opened

Definition at line 30 of file runner.cpp.

SuperNN::Runner::Runner ( )

Definition at line 26 of file runner.cpp.

SuperNN::Runner::~Runner ( )
virtual

Definition at line 36 of file runner.cpp.

Member Function Documentation

double & SuperNN::Runner::inp ( unsigned  idx)

Accessor to get/set an input value.

Parameters
idxNeuron index
Returns
Reference to the respective input value

Definition at line 74 of file runner.cpp.

void SuperNN::Runner::load_info_file ( const std::string &  info_path)

Loads the bounds info file.

Can only be called when the 'net' member variable is set.

Parameters
info_pathPath to the bounds info file
Exceptions
ErrorTypeif the input files couldn't be opened

Definition at line 67 of file runner.cpp.

double SuperNN::Runner::out ( unsigned  idx)

Accessor to get an output value.

Parameters
idxNeuron index
Returns
Value of the respective output

Definition at line 79 of file runner.cpp.

void SuperNN::Runner::run ( )

Runs the network with the current input setted by inp().

Handles the input scaling and output descaling.

Definition at line 84 of file runner.cpp.

void SuperNN::Runner::set_bounds ( Bounds from,
Bounds to 
)

Sets the bounds from already built Bound objects.

Can only be called when the 'net' member variable is set.

Parameters
fromFrom bounds
toTo bounds

Definition at line 40 of file runner.cpp.

Member Data Documentation

Data SuperNN::Runner::inp_data

Definition at line 90 of file runner.hpp.

Network SuperNN::Runner::net

Definition at line 89 of file runner.hpp.

Data SuperNN::Runner::out_data

Definition at line 90 of file runner.hpp.