name: RegressionDecisionTree : public DecisionTreeBase<RegressionDecisionTreeNode>
synopsis:

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

>     #include <RegressionDecisionTree.h>

>     RegressionDecisionTree(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, float split_threshold, float merge_threshold, float num_occ_threshold);
>     boolean eq(const RegressionDecisionTree& arg);
>     boolean setAlgorithm(ALGORITHM algorithm);

quick start:

>     RegressionDecisionTree rdt;
>     rdt.setAlgorithm(MLLR);
>     rdt.setImplementation(MEAN);

>     rdt. initRegressionTree(Vector& stat_models_a,
>     			Vector & speech_tag_a);
>     rdt.createTransform(Vector& stat_models_a);

description:
The RegressionDecisionTree class is used to build a RegressionDecisionTree by giving statistical models and speech/nonspeech tag. dependencies:

- DecisionTreeBase
- RegressionDecisionTreeNode
- StatisticalModel
- GaussianModel
- MixtureModel
- BiGraphArc
- BiGraphVertex
- SearchNode

public constants:

- define the class name:

      static const String CLASS_NAME = L"RegressionDecisionTree";

- define the algorithm choices:

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

- define the implementation choices:

      enum IMPLEMENTATION { MEAN = 0, VARIANCE, COMBINED, DEF_IMPLEMENTATION = MEAN };

- 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 };>/pre>

- define the static NameMap objects:

      static const NameMap ALGO_MAP(L"MLLR");

      static const NameMap IMPL_MAP(L"MEAN, VARIANCE, COMBINED");

      static const NameMap SUP_MODE_MAP(L"SUPERVISED, UNSUPERVISED");

      static const NameMap SEQ_MODE_MAP(L"BATCH, INCREMENTAL");

- define i/o related constants:

      static const String DEF_PARAM = L"";

      static const String PARAM_ALGORITHM = L"algorithm";

      static const String PARAM_IMPLEMENTATION = L"implementation";

      static const String PARAM_SUPERVISION_MODE = L"supervision_mode";

      static const String PARAM_SEQUENCE_MODE = L"sequence_mode";

      static const String PARAM_SPEECH_FLAG = L"speech_flag";

      static const String PARAM_NUM_TERMINALS = L"num_terminal";

      static const String PARAM_PERTURB_DEPTH = L"perturb_depth";

      static const String PARAM_OCC_THRESHOLD = L"occ_threshold";

      static const String PARAM_COMPONENTS_THRESHOLD = L"components_threshold";

      static const String PARAM_MIXTURE_OFFSET = L"mixture_offset";

      static const String PARAM_BDT = L"base_dt";

- other static constants:

      static const String YES = L"yes";

      static const String NO = L"no";

      static const String CPH = L"cph";

      static const String POS = L"pos";

- define default value(s) for the thresholds:

      static const long DEF_NUM_TERMINALS = 1;

      static const boolean DEF_SPEECH_FLAG = true;

      static const double DEF_PERTURB_DEPTH = 0.2;

      static const double DEF_OCC_THRESHOLD = 1000.0;

      static const long DEF_COMPONENTS_THRESHOLD = 100;

      static const float DEF_MERGE_THRESHOLD = 5;

      static const float DEF_NUM_OCC_THRESHOLD = 100;

error codes:

- error code indicating RegressionDecisionTree class general error:

      static const long ERR = 00100500;

- error code indicating RegressionDecisionTree class adapt no Gaussian:

      static const long ERR_ADAPT_NO_GAUSSIAN = 00100501;

- error code indicating no algorithm or implementation support yet:

      static const long ERR_UNALG_UNIMP = 00100502;

protected data:

- define the structures:

      typedef Triple< Long, Long, Long> RDataPoint;

      typedef SingleLinkedList<RDataPoint> Data;

      typedef BiGraphVertex<RegressionDecisionTreeNode> RTreeNode;

- algorithm name:

      ALGORITHM algorithm_d;

- implmentation name:

      IMPLEMENTATION implementation_d;

- adaptation supervision mode:

      SUPERVISION_MODE supervision_mode_d;

- adaptation sequence mode:

      SEQUENCE_MODE sequence_mode_d;

- data on the root node:

      RegressionDecisionTreeNode rdt_rootnode_d;

- flag to indicate if adapt non-speech sound

      Boolean speech_flag_d;

- total number of terminals

      Long num_terminals_d;

- perturb depth

      Double perturb_depth_d;

- minimum occupation count for adaptation

      Double occ_threshold_d;>/pre>

- minimal components for each node to split

      Long components_threshold_d;

- variables use to get the transform id from statistical model index and gaussian model index

      VectorLong mixture_offset_d;

      VectorLong map_stat_to_trans_d;

- local copy of the statistical model

      Vector stat_models_d;

- static memory manager:

      static MemoryManager mgr_d;

required public methods:

- static methods:

      static const String& name();

      static boolean diagnose(Integral::DEBUG debug_level);

- debug methods: setDebug method is inherited from base class

      boolean debug(const unichar* message) const;

- destructor/constructor(s):

      ~RegressionDecisionTree();

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

      RegressionDecisionTree(const RegressionDecisionTree& arg);

- assign methods:

      boolean assign(const RegressionDecisionTree& arg);

- operator= methods:

      RegressionDecisionTree& operator= (const RegressionDecisionTree& 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 RegressionDecisionTree& 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 set(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION);

- get methods:

      ALGORITHM getAlgorithm() const;

      IMPLEMENTATION getImplementation() const;

      boolean get(ALGORITHM& algorithm, IMPLEMENTATION& implementation);

- other methods:

      boolean initRegressionTree(Vector& stat_models_a, Vector & speech_tag_a);

  boolean createTransform(Vector& stat_models_a);

      boolean createTransforms(RTreeNode*& root_node_a, Vector& stat_models_a);

      boolean getMean(long sm_index_a, long gm_index_a, VectorFloat& mean_a);

      boolean getGaussianModel(long sm_index_a, long gm_index_a, GaussianModel& gm_a);

      boolean updateTransformID(Vector& stat_models_a);

      boolean setParser(SofParser* parser);

- run methods:

      boolean runDecisionTree();

private methods:

- method to find best terminal:

      RTreeNode* findBestTerminal(RTreeNode*& node_a, RTreeNode*& best_a, float& score_a);

      RTreeNode* findBestTerminal(RTreeNode*& node_a, RTreeNode*& best_a, long& components_a);

      BiGraphVertex* findBestTerminal(RTreeNode*& root_node_a, long index_a);

- method to build regression cluster:

      boolean buildRegressionCluster(RTreeNode*& root_node);

- method to perturb mean:

      boolean perturbMean(RegressionDecisionTreeNode*& child_node_a, double perturbDepth);

- method to cluster the children

      boolean clusterChildren(RegressionDecisionTreeNode*& root_node_a, RegressionDecisionTreeNode*& left_child_node_a, RegressionDecisionTreeNode*& right_child_a);

- method to cluster the children

      boolean clusterChildren(RegressionDecisionTreeNode*& root_node_a,  RegressionDecisionTreeNode*& left_child_node_a,  RegressionDecisionTreeNode*& right_child_a);

- method to calculate the distance

      boolean calculateDistance(RegressionDecisionTreeNode*& root_node_a, RegressionDecisionTreeNode*& left_child_node_a,  RegressionDecisionTreeNode*& right_child_a);

- method to create the childre node

      boolean createChildNode(RegressionDecisionTreeNode*&  root_node_a, RegressionDecisionTreeNode*& left_child_node_a, RegressionDecisionTreeNode*& right_child_a);

  examples:
  - none
  notes:
  - none