Ver Fonte

renamed decision tree builder for oblique trees

Sven Sickert há 10 anos atrás
pai
commit
026ff79ed5

+ 12 - 12
classifier/fpclassifier/randomforest/DTBRandomOblique.cpp → classifier/fpclassifier/randomforest/DTBOblique.cpp

@@ -1,5 +1,5 @@
 /**
- * @file DTBRandomOblique.cpp
+ * @file DTBOblique.cpp
  * @brief random oblique decision tree
  * @author Sven Sickert
  * @date 10/15/2014
@@ -8,7 +8,7 @@
 #include <iostream>
 #include <time.h>
 
-#include "DTBRandomOblique.h"
+#include "DTBOblique.h"
 #include "vislearning/features/fpfeatures/ConvolutionFeature.h"
 
 #include "core/vector/Algorithms.h"
@@ -21,7 +21,7 @@ using namespace OBJREC;
 using namespace std;
 using namespace NICE;
 
-DTBRandomOblique::DTBRandomOblique ( const Config *conf, string section )
+DTBOblique::DTBOblique ( const Config *conf, string section )
 {
     random_split_tests = conf->gI(section, "random_split_tests", 10 );
     max_depth = conf->gI(section, "max_depth", 10 );
@@ -33,12 +33,12 @@ DTBRandomOblique::DTBRandomOblique ( const Config *conf, string section )
     lambdaInit = conf->gD(section, "lambdaInit", 0.5 );
 }
 
-DTBRandomOblique::~DTBRandomOblique()
+DTBOblique::~DTBOblique()
 {
 
 }
 
-bool DTBRandomOblique::entropyLeftRight (
+bool DTBOblique::entropyLeftRight (
         const FeatureValuesUnsorted & values,
         double threshold,
         double* stat_left,
@@ -87,7 +87,7 @@ bool DTBRandomOblique::entropyLeftRight (
 }
 
 /** refresh data matrix X and label vector y */
-void DTBRandomOblique::getDataAndLabel(
+void DTBOblique::getDataAndLabel(
         const FeaturePool &fp,
         const Examples &examples,
         const std::vector<int> &examples_selection,
@@ -132,7 +132,7 @@ void DTBRandomOblique::getDataAndLabel(
 }
 
 /** recursive building method */
-DecisionNode *DTBRandomOblique::buildRecursive(
+DecisionNode *DTBOblique::buildRecursive(
         const FeaturePool & fp,
         const Examples & examples,
         std::vector<int> & examples_selection,
@@ -159,7 +159,7 @@ DecisionNode *DTBRandomOblique::buildRecursive(
 
     {
 #ifdef DEBUGTREE
-        std::cerr << "DTBRandomOblique: Stopping criteria applied!" << std::endl;
+        std::cerr << "DTBOblique: Stopping criteria applied!" << std::endl;
 #endif
         node->trainExamplesIndices = examples_selection;
         return node;
@@ -201,7 +201,7 @@ DecisionNode *DTBRandomOblique::buildRecursive(
     double maxValue = (max_element ( values.begin(), values.end() ))->first;
 
     if ( maxValue - minValue < 1e-7 )
-        std::cerr << "DTBRandomOblique: Difference between min and max of features values to small!" << std::endl;
+        std::cerr << "DTBOblique: Difference between min and max of features values to small!" << std::endl;
 
     // get best thresholds by complete search
     for ( int i = 0; i < random_split_tests; i++ )
@@ -258,7 +258,7 @@ DecisionNode *DTBRandomOblique::buildRecursive(
     if ( best_ig < minimum_information_gain )
     {
 #ifdef DEBUGTREE
-        std::cerr << "DTBRandomOblique: Minimum information gain reached!" << std::endl;
+        std::cerr << "DTBOblique: Minimum information gain reached!" << std::endl;
 #endif
         delete [] best_distribution_left;
         delete [] best_distribution_right;
@@ -307,7 +307,7 @@ DecisionNode *DTBRandomOblique::buildRecursive(
 #ifdef DEBUGTREE
         if ( (l>0)||(r>0) )
         {
-            std::cerr << "DTBRandomOblique: split of class " << k << " ("
+            std::cerr << "DTBOblique: split of class " << k << " ("
                       << l << " <-> " << r << ") " << std::endl;
         }
 #endif
@@ -342,7 +342,7 @@ DecisionNode *DTBRandomOblique::buildRecursive(
 }
 
 /** initial building method */
-DecisionNode *DTBRandomOblique::build ( const FeaturePool & fp,
+DecisionNode *DTBOblique::build ( const FeaturePool & fp,
                                         const Examples & examples,
                                         int maxClassNo )
 {

+ 8 - 8
classifier/fpclassifier/randomforest/DTBRandomOblique.h → classifier/fpclassifier/randomforest/DTBOblique.h

@@ -1,12 +1,12 @@
 /**
- * @file DTBRandomOblique.h
- * @brief random oblique decision tree
+ * @file DTBOblique.h
+ * @brief oblique decision tree
  * @author Sven Sickert
  * @date 10/15/2014
 
 */
-#ifndef DTBRANDOMOBLIQUEINCLUDE
-#define DTBRANDOMOBLIQUEINCLUDE
+#ifndef DTBOBLIQUEINCLUDE
+#define DTBOBLIQUEINCLUDE
 
 #include "core/vector/VectorT.h"
 #include "core/vector/MatrixT.h"
@@ -19,7 +19,7 @@
 namespace OBJREC {
 
 /** random oblique decision tree */
-class DTBRandomOblique : public DecisionTreeBuilder
+class DTBOblique : public DecisionTreeBuilder
 {
   protected:
 
@@ -121,11 +121,11 @@ class DTBRandomOblique : public DecisionTreeBuilder
   public:
 
     /** simple constructor */
-    DTBRandomOblique ( const NICE::Config *conf,
-                       std::string section = "DTBRandomOblique" );
+    DTBOblique ( const NICE::Config *conf,
+                       std::string section = "DTBOblique" );
 
     /** simple destructor */
-    virtual ~DTBRandomOblique();
+    virtual ~DTBOblique();
 
     /**
      * @brief initial building method

+ 3 - 3
classifier/fpclassifier/randomforest/FPCRandomForests.cpp

@@ -19,7 +19,7 @@
 #include "vislearning/classifier/fpclassifier/randomforest/DTBStandard.h"
 #include "vislearning/classifier/fpclassifier/randomforest/DTBRandom.h"
 #include "vislearning/classifier/fpclassifier/randomforest/DTBClusterRandom.h"
-#include "vislearning/classifier/fpclassifier/randomforest/DTBRandomOblique.h"
+#include "vislearning/classifier/fpclassifier/randomforest/DTBOblique.h"
 #include "vislearning/cbaselib/FeaturePool.h"
 
 using namespace OBJREC;
@@ -65,8 +65,8 @@ FPCRandomForests::FPCRandomForests(const Config *_conf, std::string section) : c
 			builder = new DTBRandom ( conf, builder_section );
 		else if (builder_method == "cluster_random" )
 			builder = new DTBClusterRandom ( conf, builder_section );
-        else if (builder_method == "random_oblique" )
-            builder = new DTBRandomOblique ( conf, builder_section );
+        else if (builder_method == "oblique" )
+            builder = new DTBOblique ( conf, builder_section );
 		else {
 			fprintf (stderr, "DecisionTreeBuilder %s not yet implemented !\n", builder_method.c_str() );
 			exit(-1);