Lightweight Neural Network++ documentation

Visit the lwnnplus home page, download the technical report in english or italian.

Main Page | Class Hierarchy | Class List | File List | Class Members

iomanage Class Reference

This is an abstract class which declares some methods to be implemented by a iomanager. To use your own input procedures you must write a derived class of iomanage that implements the two methods, info_from_file and load_patterns. More...

#include <iomanage.h>

Inheritance diagram for iomanage:

iomanagebinary iomanagelwnnfann List of all members.

Public Member Functions

virtual void info_from_file (const string &filename, int *npatterns, int *ninput, int *noutput)=0
 Read info from file.
virtual void load_patterns (const string &filename, float **inputs, float **targets, int ninput, int noutput, int npatterns)=0
 Read patterns from file.
virtual void allocate_and_load (const string &filename, float **&inputs, float **&targets, int *ninput, int *noutput, int *npatterns)
 Allocate memory and load data from a file.

Static Public Member Functions

void allocate_data (int npattern, int ninput, int noutput, float **&input, float **&target)
 Allocate data for patterns.
void destroy (int npatterns, float **input, float **output)
 free memory for input and output

Detailed Description

This is an abstract class which declares some methods to be implemented by a iomanager. To use your own input procedures you must write a derived class of iomanage that implements the two methods, info_from_file and load_patterns.

The class implements two static methods to allocate and destroy input and output vectors. Method allocate_data can be used to call allocate_data and load_patterns (virtually binded to the derived class method).

One example of a derived class is iomanagelwnnfann.


Member Function Documentation

virtual void iomanage::info_from_file const string &  filename,
int *  npatterns,
int *  ninput,
int *  noutput
[pure virtual]
 

Read info from file.

Parameters:
filename the name of a file of input/output pairs
npatterns Pointer to a int where is returned the number of pairs in the file
ninput Pointer to a int where is returned the number of inputs
noutput Pointer to a int where is returned the number of outputs
Can throw a runtime_error exception if file does not exist.

Implemented in iomanagebinary, and iomanagelwnnfann.

virtual void iomanage::load_patterns const string &  filename,
float **  inputs,
float **  targets,
int  ninput,
int  noutput,
int  npatterns
[pure virtual]
 

Read patterns from file.

Parameters:
filename the name of a file of input/output pairs
inputs Read the inputs in this matrix
targets Reat the targets in this matrix
ninput Number of inputs wanted.
noutput Number of outputs wanted
npatterns Number of patterns wanted
Precondition: memory in inputs and outputs has been allocated for npatterns with ninput and noutput vectors. (First index is the index of pattern, second index is the index of neuron). You can use allocate_data() to allocate the memory.

If the number of inputs or outputs of the patterns in the file is not equal to ninput and noutput throws a runtime_error. Can throw a runtime_error exception if the format of the file isn't right.

Implemented in iomanagebinary, and iomanagelwnnfann.

void iomanage::allocate_data int  npattern,
int  ninput,
int  noutput,
float **&  input,
float **&  target
[static]
 

Allocate data for patterns.

Parameters:
npattern number of patterns
ninput number of inputs
noutput number of outputs
input vector of inputs (not allocated)
target vector of targets (not allocated)

virtual void iomanage::allocate_and_load const string &  filename,
float **&  inputs,
float **&  targets,
int *  ninput,
int *  noutput,
int *  npatterns
[virtual]
 

Allocate memory and load data from a file.

Parameters:
filename the name of a file of input/output pairs
inputs Read the inputs in this matrix
targets Reat the targets in this matrix
ninput Return Number of inputs.
noutput Return Number of outputs
npatterns Return Number of patterns

void iomanage::destroy int  npatterns,
float **  input,
float **  output
[static]
 

free memory for input and output

Parameters:
npatterns Number of patterns
input Input vector to be freed
output Output vector to be freed


The documentation for this class was generated from the following file:
Generated on Tue Oct 12 00:32:12 2004 for Lightweight Neural Network ++ by  doxygen 1.3.9