NODElib Documentation

By Gary William Flake

NAME

dsfifo.h - DATASET_METHOD for fixed-size FIFO.

SYNOPSIS

A FIFO (first in, first out) allows you to hold the most current training patterns in a fixed size set. Whenever a new pattern is added, the oldest pattern is overwritten. This is handy for incremental learning.

#include <dsfifo.h>

DSM_FIFO *dsm_fifo(unsigned xsz,
    unsigned 
ysz,
    unsigned 
sz);

void dsm_fifo_new_pattern(DSM_FIFO *fifo,
      double *
x,
      double *
y);

void dsm_destroy_fifo(DSM_FIFO *fifo);

DESCRIPTION

Type Declarations

The following types are defined in the header file dsfifo.h.

DSM_FIFO

typedef struct DSM_FIFO {
  double **x, **y;
  unsigned xsz, ysz, sz;
  unsigned used, first;
} DSM_FIFO;

A DSM_FIFO defines a fixed-width sliding window of training patterns. You should never manipulate this structure directly. The meaning of all of the fields is mostly obvious. The used field contains the number (less or equal to sz) of positions used in the DSM_FIFO. The first field is used to keep track of where the most recently added pattern is located.

Function Definitions

The following function prototypes are given in the header file dsfifo.h.

DSM_FIFO *dsm_fifo(unsigned xsz,
    unsigned 
ysz,
    unsigned 
sz);

Creates a DSM_FIFO with the pattern dimensions specified by xsz and ysz, while sz is the number of patterns that can be stored in the DSM_FIFO at any time.

void dsm_fifo_new_pattern(DSM_FIFO *fifo,
      double *
x,
      double *
y);

If fifo is not full, then the new data is copied into fifo. But if fifo is full, then the oldest pattern is replaced with the new pattern.

void dsm_destroy_fifo(DSM_FIFO *fifo);

Free up any memory that was allocated with the allocation routine.

AUTHOR

Gary William Flake (gary.flake@usa.net).

SEE ALSO

dsmethod(3), and dataset(3).