// file: $isip/class/pr/MaximumLikelihoodLinearRegression/MaximumLikelihoodLinearRegression.h // version: $Id: MaximumLikelihoodLinearRegression.h 9470 2004-05-10 15:40:08Z gao $ // // make sure definitions are only made once // #ifndef ISIP_MAXIMUM_LIKELIHOOD_LINEAR_REGRESSION #define ISIP_MAXIMUM_LIKELIHOOD_LINEAR_REGRESSION // isip include files // #ifndef ISIP_REGRESSION_DECISION_TREE_NODE #include #endif #ifndef ISIP_REGRESSION_DECISION_TREE #include #endif #ifndef ISIP_STATISTICAL_MODEL_ADAPTATION #include #endif // forward class definitions: // // we must define the RegressionDecisionTreeNode, // RegressDecisionTreeNode, Transform, and Adapt class here first // because the header files might be short-circuited by the ifndef. // class RegressionDecisonTreeNode; class RegressionDecisonTree; class StatisticalModelAdaptation; // MaximumLikelihoodLinearRegression: a class that controls the // process of MLLR adaptation // class MaximumLikelihoodLinearRegression { //--------------------------------------------------------------------------- // // public constants // //--------------------------------------------------------------------------- public: // define the class name // static const String CLASS_NAME; //---------------------------------------- // // other important constants // //---------------------------------------- // define the algorithm choices // enum ALGORITHM { REGRESSION_TREE = 0, TRANSFORM, ADAPT, ALL, DEF_ALGORITHM = ALL }; // define the implementation choices // enum IMPLEMENTATION { ML = 0, MEAN, VARIANCE, DEF_IMPLEMENTATION = ML }; // define the adaptation supervision choices // enum SUPERVISION_MODE { SUPERVISED = 0, UNSUPERVISED, DEF_SUPERVISION_MODE = SUPERVISED }; // define the adaptation sequence choices // enum SEQUENCE_MODE { BATCH = 0, INCREMENTAL, DEF_SEQUENCE_MODE = BATCH }; // define the static NameMap objects // static const NameMap ALGO_MAP; static const NameMap IMPL_MAP; static const NameMap SUP_MODE_MAP; static const NameMap SEQ_MODE_MAP; //---------------------------------------- // // i/o related constants // //---------------------------------------- static const String DEF_PARAM; static const String PARAM_ALGORITHM; static const String PARAM_IMPLEMENTATION; static const String PARAM_SUPERVISION_MODE; static const String PARAM_SEQUENCE_MODE; static const String PARAM_RDT; static const String PARAM_SM_ADAPT; static const String PARAM_DBGL; //---------------------------------------- // // default values and arguments // //---------------------------------------- // define default values for the thresholds // static const int DEF_NUM_CLASSES = 1; static const float32 DEF_MERGE_THRESHOLD = 5; static const float32 DEF_NUM_OCC_THRESHOLD = 100; //---------------------------------------- // // error codes // //---------------------------------------- static const int32 ERR = 00100700; static const int32 ERR_UNALG_UNIMP = 00100701; //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // algorithm name // ALGORITHM algorithm_d; // implementation name // IMPLEMENTATION implementation_d; // adaptation supervision mode // SUPERVISION_MODE supervision_mode_d; // adaptation sequence mode // SEQUENCE_MODE sequence_mode_d; // regression decision tree // RegressionDecisionTree rdt_d; // statistical model adaptation // StatisticalModelAdaptation sm_adapt_d; // local copy of the statistical model // Vector stat_models_d; // debug level // DebugLevel debug_level_d; // static memory manager // static MemoryManager mgr_d; //--------------------------------------------------------------------------- // // required public methods // //--------------------------------------------------------------------------- public: // method: name // static const String& name() { return CLASS_NAME; } // other static methods // static bool8 diagnose(Integral::DEBUG debug_level); // debug methods: // setDebug is inherited from the base class // bool8 debug(const unichar* msg) const; // method: destructor // ~MaximumLikelihoodLinearRegression() { } // method: default constructor // MaximumLikelihoodLinearRegression(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION) { algorithm_d = algorithm; implementation_d = implementation; } // method: copy constructor // MaximumLikelihoodLinearRegression(const MaximumLikelihoodLinearRegression& arg) { assign(arg); } // assign methods // bool8 assign(const MaximumLikelihoodLinearRegression& arg); // method: operator= // MaximumLikelihoodLinearRegression& operator= (const MaximumLikelihoodLinearRegression& arg) { assign(arg); return *this; } // i/o methods // int32 sofSize() const; // method: read // bool8 read(Sof& sof, int32 tag) { return read(sof, tag, name()); } bool8 read(Sof& sof, int32 tag, const String& name); // method: write // bool8 write(Sof& sof, int32 tag) const { return write(sof, tag, name()); } bool8 write(Sof& sof, int32 tag, const String& name) const; // method: readData // bool8 readData(Sof& sof, const String& pname = DEF_PARAM, int32 size = SofParser::FULL_OBJECT, bool8 param = true, bool8 nested = false); // method: writeData // bool8 writeData(Sof& sof, const String& pname = DEF_PARAM) const; // equality methods // bool8 eq(const MaximumLikelihoodLinearRegression& arg) const; // method: new // static void* operator new(size_t size) { return mgr_d.get(); } // method: new[] // static void* operator new[](size_t size) { return mgr_d.getBlock(size); } // method: delete // static void operator delete(void* ptr) { mgr_d.release(ptr); } // method: delete[] // static void operator delete[](void* ptr) { mgr_d.releaseBlock(ptr); } // method: setGrowSize // static bool8 setGrowSize(int32 grow_size) { return mgr_d.setGrow(grow_size); } // other memory management methods // bool8 clear(Integral::CMODE ctype = Integral::DEF_CMODE); //--------------------------------------------------------------------------- // // class-specific public methods: // set methods // //--------------------------------------------------------------------------- // method: setAlgorithm // bool8 setAlgorithm(ALGORITHM algorithm) { algorithm_d = algorithm; return true; } // method: setImplementation // bool8 setImplementation(IMPLEMENTATION implementation) { implementation_d = implementation; return true; } // method: set // bool8 set(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION) { algorithm_d = algorithm; implementation_d = implementation; return true; } //--------------------------------------------------------------------------- // // class-specific public methods: // get methods // //--------------------------------------------------------------------------- // method: getAlgorithm // ALGORITHM getAlgorithm() const { return algorithm_d; } // method: getImplementation // IMPLEMENTATION getImplementation() const { return implementation_d; } // method: get // bool8 get(ALGORITHM& algorithm, IMPLEMENTATION& implementation) { algorithm = algorithm_d; implementation = implementation_d; return true; } // method to init the regression tree // bool8 initRegressionTree(Vector& stat_models_a, Vector & speech_tag_a); // method to create transform // bool8 createTransform(Vector& stat_models_a); // method to adapt the model // bool8 adapt(Vector& stat_models_a); //--------------------------------------------------------------------------- // // class-specific public methods: // computational methods // //--------------------------------------------------------------------------- // method to set the parser // bool8 setParser(SofParser* parser); //--------------------------------------------------------------------------- // // private methods // //--------------------------------------------------------------------------- private: }; // end of include file // #endif