name: FeatureSelect
synopsis:

>     g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_algo.a

>     #include <FeatureSelect.h>

>     FeatureSelect(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, float floor);
>     boolean eq(const FeatureSelect& arg);
>     boolean setDimension(long dim);

quick start:

>     none. this class is not to be used in isolation. this class provides
>     the base functionality for the isip_feature_select utility.

description:
The FeatureSelect class is used to provide the base functionality for the isip_feature_select utilty. Currently, one algorithm is supported:

- CLASS_BASED - selects out-of-class data

One implementation supported for CLASS_BASED is:

- NONE

The good reference for this functionalty is:

Aravind Ganapathiraju, "Support Vector Machines for Speech Recognition", , Ph.D Dissertation, May 2002.

dependencies:

- VectorFloat
- Sdb
- FeatureFile
- AudioDatabase
- MemoryManager

public constants:

- define the class name:

      static const String CLASS_NAME = L"FeatureSelect";

- define the algorithm choices:

      enum ALGORITHM { CLASS_BASED = 0, DEF_ALGORITHM = CLASS_BASED };

- define the implementation choices:

      enum IMPLEMENTATION { NONE = 0, DEF_IMPLEMENTATION = NONE };

- define the static NameMap objects:

      static const NameMap ALGO_MAP(L"CLASS_BASED");

      static const NameMap IMPL_MAP(L"NONE");

- define i/o related constants:

      static const String DEF_PARAM = L"";

      static const String PARAM_ALGORITHM;

      static const String PARAM_IMPLEMENTATION;

- define default argument(s):

      static const unichar DEF_DELIM = L':';

      static const long DEF_DIMENSION = 118;

      static const String DEF_RATIO_CLASS;

      static const String DEF_RATIO_SIMILAR;

      static const String DEF_OUTPUT_SUFFIX;

error codes:

- error code indicating FeatureSelect class general error:

      static const long ERR = 50900;

protected data:

- data common to all algorithms and implementations:
  - define an algorithm name:

        ALGORITHM algorithm_d;

  - define an implementation name:

        IMPLEMENTATION implementation_d;

  - define variables associated to feature selection

        VectorLong ratio_class_d;

        VectorLong ratio_similar_d;

  - define variables associated with output feature file

        Long dim_d;

        FeatureFile::FILE_TYPE input_type_d;

        FeatureFile::FILE_FORMAT input_format_d;

  - variables associated with output feature file

        FeatureFile::FILE_TYPE output_type_d;

        FeatureFile::FILE_FORMAT output_format_d;

        String output_directory_d;

        String output_extension_d;

        Long output_preserve_d;

        String output_suffix_d;

  - variables associated with the databases

        Filename audiodb_file_d;

        AudioDatabase audiodb_d;

  - static memory manager:

        static MemoryManager mgr_d;

required public methods:

- static methods:

      static const String& name();

      static boolean diagnose(Integral::DEBUG debug_level);

      static boolean setDebug(Integral::DEBUG debug_level);

- other debug methods:

      boolean debug(const unichar* message) const;

- destructor/constructor(s):

      ~FeatureSelect();

      FeatureSelect(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, float floor);

      FeatureSelect(const FeatureSelect& arg);

- assign methods:

      boolean assign(const FeatureSelect& arg);

- operator= methods:

      FeatureSelect& operator= (const FeatureSelect& arg);

- i/o methods:

      long sofSize() const;

      boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);

      boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;

      boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);

      boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;

- equality methods:

      boolean eq(const FeatureSelect& arg) const;

- memory management methods:

      static void* operator new(size_t size);

      static void* operator new[](size_t size);

      static void operator delete(void* ptr);

      static void operator delete[](void* ptr);

      static boolean setGrowSize(long grow_size);

      boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);

class-specific public methods:

- set methods:

      boolean setAlgorithm(ALGORITHM algorithm);

      boolean setImplementation(IMPLEMENTATION implementation);

      boolean setAudioDatabaseFile(const Filename& audiodb_file);

      boolean setDimension(long dim = DEF_DIMENSION);

      boolean setRatioClass(const String& ratio);

      boolean setRatioSimilar(const String& ratio);

      boolean setInputType(const FeatureFile::FILE_TYPE input_type = FeatureFile::DEF_FILE_TYPE));

      boolean setInputFormat(const FeatureFile::FILE_FORMAT input_format = FeatureFile::DEF_FILE_FORMAT));

      boolean setOutputType(const FeatureFile::FILE_TYPE output_type = FeatureFile::DEF_FILE_TYPE));

      boolean setOutputFormat(const FeatureFile::FILE_FORMAT output_format = FeatureFile::DEF_FILE_FORMAT));

      boolean setOutputDirectory(const String& new_dir);

      boolean setOutputExtension(const String& extension);

      boolean setOutputPreserve(const long preserve);

      boolean setOutputSuffix(const String& suffix);

      boolean setVerbosity(const Integral::DEBUG verbosity);

- get methods:

      ALGORITHM getAlgorithm() const;

      IMPLEMENTATION getImplementation() const;

      Filename getAudioDatabaseFile() const;

      long getDimension() const;

      VectorLong getRatioClass() const;

      VectorLong getRatioSimilar() const;

      FeatureFile::FILE_TYPE getInputType() const;

      FeatureFile::FILE_FORMAT getInputFormat() const;

      FeatureFile::FILE_TYPE getOutputType() const;

      FeatureFile::FILE_FORMAT getOutputFormat() const;

      String getOutputDirectory() const;

      String getOutputExtension() const;

      long getOutputPreserve() const;

      String getOutputSuffix() const;

- computational methods:

      boolean compute(String& symbol, Sdb& symbols_similar, Sdb& symbols_all);

private methods:

- methods to open databases

      boolean openAudioDatabase();

- methods to close databases

      boolean closeAudioDatabase();

- method to retrieve feature file from audio database

      boolean retrieveFtrFile(const Strinf& identifier, Filename& ftr_file);

- method to read features from feature file

      boolean readFeatures(const Filename& ftr_file, Vector& features);

- method to write features from feature file

      boolean writeFeatures(const Filename& ftr_file, const Vector& features);

- method to select features on a class basis

      boolean computeClassBased(const String& symbol, Sdb& symbols_similar, Sdb& symbols_all);

- method to get features corresponding to symbols

      boolean getAllFeatures(Sdb& symbols, long num_feat_vectors, Vector&th;VectorFloat> features);

- method to get features corresponding to a symbol

      boolean getFeatures(String& symbol, long num_feat_vectors, Vector&th;VectorFloat> features);

examples:

- none. this class is not to be used directly.

notes:

- none