Into

Modules

Documentation

classPiiVectorQuantizer

#include <PiiVectorQuantizer.h>

A vector quantizer.

Inherits PiiClassifier< SampleSet >

Inherited by PiiKnnClassifier< SampleSet >, PiiSom< SampleSet >

Description

Vector quantization is perhaps the most primitive way of performing classification. A vector quantizer holds a number of model vectors (a.k.a. the code book) to which it compares any unknown sample. As a classification result, the index of the closest vector is returned. The "closeness" is defined in terms of a distance measure".

Public types

typedef PiiSampleSet::Traits< SampleSet >::ConstFeatureIterator
typedef PiiSampleSet::Traits< SampleSet >::FeatureIterator

Constructors and destructor

(
  • PiiDistanceMeasure< ConstFeatureIterator > * measure
)

Create a new vector quantizer with the given distance measure.

Create a vector quantizer with PiiSquaredGeometricDistance as the distance measure.

Destroy the vector quantizer.

Public member functions

virtual double
(
  • ConstFeatureIterator featureVector
)

Returns the index of the closest vector in the model set.

PiiDistanceMeasure< ConstFeatureIterator > *

Returns the distance measure.

int

Returns the number of dimensions in the model samples.

virtual int
(
  • ConstFeatureIterator featureVector
  • double * distance
)

Analogous to classify(), but also returns the distance to the closest neighbor.

ConstFeatureIterator
(
  • int index
)

Returns a const iterator to the beginning of the model sample at index.

FeatureIterator
(
  • int index
)

Returns a modifiable iterator to the beginning of the model sample at index.

int

Returns the number of model vectors in the model sample set.

SampleSet &
( )

Returns a modifiable reference to the model set.

SampleSet
( )

Returns the model sample set.

double

Get the reject threshold.

void
(
  • PiiDistanceMeasure< ConstFeatureIterator > * measure
)

Sets the distance measure.

void
(
  • const SampleSet & models
)

Set the model sample set.

void
(
  • double rejectThreshold
)

Set a distance threshold for rejecting samples.

Protected member functions

Function details

  • PiiVectorQuantizer

    (
    • PiiDistanceMeasure< ConstFeatureIterator > * measure
    )

    Create a new vector quantizer with the given distance measure.

    Parameters
    measure

    the way of measuring distances between vectors. PiiVectorQuantizer takes the ownership of the pointer. The distance measure must be set before calling classify().

  • PiiVectorQuantizer

    ()

    Create a vector quantizer with PiiSquaredGeometricDistance as the distance measure.

  • ~PiiVectorQuantizer

    ()

    Destroy the vector quantizer.

    Also deletes the distance measure.

  • virtual double classify

    (
    • ConstFeatureIterator featureVector
    )
    [virtual]

    Returns the index of the closest vector in the model set.

    If two vectors are equally close, the one first in the model set will returned. If the feature vector cannot be classified, NaN will be returned. Calls findClosestMatch() by default.

    Reimplemented from PiiClassifier.

  • PiiDistanceMeasure< ConstFeatureIterator > * distanceMeasure

    ()

    Returns the distance measure.

  • int featureCount

    ()

    Returns the number of dimensions in the model samples.

  • virtual int findClosestMatch

    (
    • ConstFeatureIterator featureVector
    • double * distance
    )
    [virtual]

    Analogous to classify(), but also returns the distance to the closest neighbor.

  • ConstFeatureIterator modelAt

    (
    • int index
    )

    Returns a const iterator to the beginning of the model sample at index.

  • FeatureIterator modelAt

    (
    • int index
    )

    Returns a modifiable iterator to the beginning of the model sample at index.

  • int modelCount

    ()

    Returns the number of model vectors in the model sample set.

  • SampleSet & models

    ()

    Returns a modifiable reference to the model set.

  • SampleSet models

    ()

    Returns the model sample set.

  • double rejectThreshold

    ()

    Get the reject threshold.

  • void setDistanceMeasure

    (
    • PiiDistanceMeasure< ConstFeatureIterator > * measure
    )

    Sets the distance measure.

    This class takes the ownership of measure. The old distance measure will be deleted.

  • void setModels

    (
    • const SampleSet & models
    )

    Set the model sample set.

  • void setRejectThreshold

    (
    • double rejectThreshold
    )

    Set a distance threshold for rejecting samples.

    If the distance to the closest code vector is above this threshold, the sample is rejected and #classify(const PiiMatrix<T>&) returns -1.

  • PII_DISABLE_COPY

    [protected]
Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.