VQ_LBG(1SP)

NAME
VQ_LBG - performs Vector Quantization based on a the Algorithm proposed by Linde,Buzo and Gray, using the Euclidian distortion measure. .SH SYNOPSIS VQ_LBG [options] {basename}

DESCRIPTION
VQ_LBG performs Vector Quantization using the well known algorithm proposed by Linde,Buzo and Gray, using the Euclidian distortion measure. Data is read in binary form, with a header describing the size and byte ordering of the binary data to follow. The incoming training data vector is denoted by basename.vec. The resulting codebook file, is denoted by basename.code and uses the same header as for the binary training vector file.

HEADER
All binary files are assumed to be in floating point format with a text header describing the size (number of rows and columns) and the byte ordering respectively. The header must be of the following format [rows]
[colums]
{byte indicating byteordering} See below for sample code.

OPTIONS

-f name of feature vector file
    [basename.vec]

-c name of code book file
    [basename.code]

-n number of vectors in codebook
    [64]

-i maximum number of iterations
    [100]

-s continue training using
    [start over]

-r random number generator seed
    [123]

-p display error measure on screen
    [do not]

-t test codebook on the specified file
    [train]

-h Help

SAMPLE CODE FOR CREATING DATA FILE
The following C code can be used to create a file and same the data to disk, and therefore conforming to the header which is needed by the VQ_LBG program void Dump_to_File (char *filename, float **data,
                   int number_of_rows, number_of_cols)
{
  FILE *outfile;
  int i, j;
  char byteordering;
  /* create file */
  if (!(outfile = fopem(filename, "w"))) {
    fprintf(stderr, "Error creating file: %s, filename);
    exit(1);
  }
  /* text header for number of rows and columns in data */
  fprintf(outfile, "%dd, number_of_rows, number_of_cols);
  /* binary part of header for byte ordering */
  byteordering = LittleIndian();
  fwrite(&byteordering, sizeof(char), 1, outfile);
  /* dump data to disc */
  for (i=0; i<number_of_rows; i++)
    for (j=0; j<number_of_cols; j++)
      fwrite(&data[i][j], sizeof(float), 1, outfile);
  fclose(outfile);
}

EXAMPLE
Assume we have the following data file data.vec
120
20
(byteordering)
 .... (some binary data) The we can create a codebook using the default parameters just by typing VQ_LBG data We can now calculate the distortion of this codebook on a new test data file data.test.vec by typing VQ_LBG -c data.code -t data.test

SEE ALSO
LittleIndian (3SP)

BUGS

AUTHORS
Johan Schalkwyk
Center for Spoken Language Understanding
Department of Computer Science and Engineering
Oregon Graduate Institute