|
@@ -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 )
|
|
|
{
|