⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 decisiontreebase.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
📖 第 1 页 / 共 2 页
字号:
template<class TObject>const NameMap DecisionTreeBase<TObject>::RUNMODE_MAP(L"TRAIN, CLASSIFY");// below are all the methods for the DecisionTreeBase template class//      // ---------------------------------------------------------------------//// required static methods////----------------------------------------------------------------------// ---------------------------------------------------------------------//// required debug methods////----------------------------------------------------------------------// method: debug//// arguments://  const unichar* msg: (input) message to print//// return: a boolean value indicating status//template<class TObject>boolean DecisionTreeBase<TObject>::debug(const unichar* msg_a) const {  // declare local variables  //  String value;  String output;   // output an information message  //  output.debugStr(name(), msg_a, L":");  Console::put(output);  Console::increaseIndention();    // display debug level  //  output.debugStr(name(), msg_a, L"debug_level_d", debug_level_d.getName());  Console::put(output);  // display the various modes  //  output.debugStr(name(), msg_a, L"stopmode_d",                  STOPMODE_MAP.getName((long)stopmode_d));  Console::put(output);  output.debugStr(name(), msg_a, L"runmode_d",                  RUNMODE_MAP.getName((long)runmode_d));  Console::put(output);    // display common decision tree parameters  //  value.assign(depth_d);  output.debugStr(name(), msg_a, L"depth_d", value);  Console::put(output);  // display the attributes  //  attributes_d.debug(L"attributes_d");    // call the parent BiGraph debug method to debug the tree  //  BiGraph<TObject>::debug(L"BiGraph Tree");  // decrease indention  //  Console::decreaseIndention();   // exit gracefully  //  return true;}//------------------------------------------------------------------------//// required destructor/constructor(s)////-----------------------------------------------------------------------// method: constructor//// arguments: none//// return: none//// this is the default constructor//template<class TObject>DecisionTreeBase<TObject>::DecisionTreeBase() {  // initialize protected data  //  stopmode_d = DEF_STOPMODE;  runmode_d = DEF_RUNMODE;  depth_d = DEF_DEPTH;}//-------------------------------------------------------------------------////  required assign methods////-------------------------------------------------------------------------// method: assign//// arguments://  const DecisionTreeBase& arg: (input) object to assign//// return: a boolean value indicating status//// this method assigns the input argument to "this".//template<class TObject>boolean DecisionTreeBase<TObject>::assign(const DecisionTreeBase<TObject>&					  arg_a) {  // assign data related to i/o  //  debug_level_d = arg_a.debug_level_d;  // assign other protected data  //  stopmode_d = arg_a.stopmode_d;  runmode_d = arg_a.runmode_d;  depth_d = arg_a.depth_d;  attributes_d = arg_a.attributes_d;    // exit gracefully  //  return true;}// method: eq//// arguments://  const DecisionTreeBase& arg: (input) input object//// return: a boolean value indicating status//// this method checks if two objects are the same//template<class TObject>boolean DecisionTreeBase<TObject>::eq(const DecisionTreeBase<TObject>& arg_a)  const {  // check all internal data  //  if (((DebugLevel)debug_level_d != arg_a.debug_level_d) ||      (stopmode_d != arg_a.stopmode_d) ||      (runmode_d != arg_a.runmode_d) ||      (depth_d != arg_a.depth_d) ||      (!attributes_d.eq(arg_a.attributes_d)) ||      !(((BiGraph<TObject>*)this)->eq((BiGraph<TObject>)arg_a))) {        return false;  }        // exit gracefully  //  return true;}// method: clear//// arguments://  Integral::CMODE ctype: (input) clear mode//// return: a boolean value indicating status//template<class TObject>boolean DecisionTreeBase<TObject>::clear(Integral::CMODE ctype_a) {  // debug level is typically a parameter, so keep its setting in  // retain mode.  //  if (ctype_a != Integral::RETAIN) {    debug_level_d.assign(Integral::DEF_DEBUG);  }  // reset to initial state for all values of ctype_a  //  stopmode_d = DEF_STOPMODE;  runmode_d = DEF_RUNMODE;  // clear the attributes  //  attributes_d.clear(ctype_a);  // call the clear method of the Bigraph  //  clear(ctype_a);	  // exit gracefully  //  return true;}// method: getLeafNodes//// arguments://  BiGraphVertex<TObject>& node: (input) input node//  SingleLinkedList<BiGraphVertex<TObject> >& leaf_nodes: (output) list of//                                                         output nodes//// return: a boolean value indicating status//// this method returns the LeafNodes at same-level or one-level below// a node in the decisiontree//template<class TObject>boolean DecisionTreeBase<TObject>::getLeafNodes(BiGraphVertex<TObject>& node_a,       		 SingleLinkedList<BiGraphVertex<TObject> >& leaf_nodes_a) {    // local variables  //  DoubleLinkedList<BiGraphArc<TObject> >* children;  BiGraphArc<TObject>* child;  BiGraphVertex<TObject>* child_node;  BiGraphVertex<TObject>* temp_node;  SingleLinkedList<BiGraphVertex<TObject> > nodes(DstrBase::USER);  SingleLinkedList<BiGraphVertex<TObject> > nonleaf_nodes(DstrBase::USER);    boolean nonleaf = true;    // get all the child nodes of this node  //  children = node_a.getChildren();    // if this node has child nodes, accumulate the child nodes  //  if (node_a.gotoFirstChild()) {    // loop-over all the child nodes and accumulate these nodes    //    for (boolean more = children->gotoFirst(); more;	 more = children->gotoNext()) {                  child = children->getCurr();      child_node = child->getVertex();      nodes.insert(child_node);    }  }    // else this node is a leaf node, no child nodes and so exit  //  else {    leaf_nodes_a.insert(&node_a);    nonleaf = false;  }  // loop till all the leafnodes are found  //  while (nonleaf) {        nonleaf = false;    // loop over all the nodes and accumulate the leaf nodes    //    for (boolean more = nodes.gotoFirst(); more;	 more = nodes.gotoNext()) {                      temp_node = nodes.getCurr();            // nodes that don't have children are leaf nodes      //      if (!temp_node->gotoFirstChild()) {		// add this leaf node to the singlelinkedlist	//	leaf_nodes_a.insert(temp_node);      }            // store the nonleaf nodes seperately      //      else {	nonleaf_nodes.insert(temp_node);      	nonleaf = true;      }        }        // reset the memory    //    nodes.clear(Integral::RESET);    // loop over all the nonleaf nodes and accumulate their children    //    for (boolean more = nonleaf_nodes.gotoFirst(); more;	 more = nonleaf_nodes.gotoNext()) {                      // get all the child nodes of this nodes      //      temp_node = nonleaf_nodes.getCurr();      children = temp_node->getChildren();            // loop-over all the child nodes and accumulate them      //      for (boolean morea = children->gotoFirst(); morea;	   morea = children->gotoNext()) {            	child = children->getCurr();	child_node = child->getVertex();	nodes.insert(child_node);      }    }    // reset the memory    //    nonleaf_nodes.clear(Integral::RESET);      }    // exit gracefully  //  return true;}// end of include file// #endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -