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

iomanagebinary Class Reference

Class for reading and writing binary patterns file. More...

#include <iomanagebinary.h>

Inheritance diagram for iomanagebinary:

iomanage List of all members.

Public Member Functions

 iomanagebinary ()
 Constructor Does nothing, of course, because the class has no fields!
virtual void info_from_file (const string &filename, int *npatterns, int *ninput, int *noutput)
 Read info from file.
virtual void load_patterns (const string &filename, float **inputs, float **targets, int ninput, int noutput, int npatterns)
 Read patterns from file.
void write_patterns (const string &filename, float **inputs, float **targets, int ninput, int noutput, int npatterns)
 Write patterns to a binary file file.
void convert (const string &sourceformatfn, const string &binformatfn, iomanage *sourceFormatIomanager)
 Convert patterns from any format to binary format.

Detailed Description

Class for reading and writing binary patterns file.

This class extends iomanage and implements the reading from a binary file The method write_patterns make easy to write a binary pattern file and to convert any training set in this format


Member Function Documentation

virtual void iomanagebinary::info_from_file const string &  filename,
int *  npatterns,
int *  ninput,
int *  noutput
[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.

Implements iomanage.

virtual void iomanagebinary::load_patterns const string &  filename,
float **  inputs,
float **  targets,
int  ninput,
int  noutput,
int  npatterns
[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)

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

Implements iomanage.

void iomanagebinary::write_patterns const string &  filename,
float **  inputs,
float **  targets,
int  ninput,
int  noutput,
int  npatterns
 

Write patterns to a binary file file.

Parameters:
filename the name of the file to be written
inputs Read the inputs in this matrix
targets Reat the targets in this matrix
ninput Number of inputs.
noutput Number of outputs
npatterns Number of patterns
Can throw a runtime_error exception if file is not writeable.

void iomanagebinary::convert const string &  sourceformatfn,
const string &  binformatfn,
iomanage sourceFormatIomanager
 

Convert patterns from any format to binary format.

Parameters:
sourceformatfn filename containing patterns in original format
binformatfn filename to be written in binary format
sourceFormatIomanager iomanager managing file in original format


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