|
@@ -15,7 +15,7 @@
|
|
|
|
|
|
using namespace OBJREC;
|
|
|
|
|
|
-#define DEBUGTREE
|
|
|
+
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
@@ -270,7 +270,7 @@ void DTBObliqueLS::regularizeDataMatrix(
|
|
|
void DTBObliqueLS::findBestSplitThreshold (
|
|
|
FeatureValuesUnsorted &values,
|
|
|
SplitInfo &bestSplitInfo,
|
|
|
- const NICE::Vector &beta,
|
|
|
+ const NICE::Vector ¶ms,
|
|
|
const double &e,
|
|
|
const int &maxClassNo )
|
|
|
{
|
|
@@ -319,7 +319,7 @@ void DTBObliqueLS::findBestSplitThreshold (
|
|
|
{
|
|
|
bestSplitInfo.informationGain = ig;
|
|
|
bestSplitInfo.threshold = threshold;
|
|
|
- bestSplitInfo.params = beta;
|
|
|
+ bestSplitInfo.params = params;
|
|
|
|
|
|
for ( int k = 0 ; k <= maxClassNo ; k++ )
|
|
|
{
|
|
@@ -348,10 +348,8 @@ DecisionNode *DTBObliqueLS::buildRecursive(
|
|
|
double lambdaCurrent )
|
|
|
{
|
|
|
|
|
|
-#ifdef DEBUGTREE
|
|
|
std::cerr << "DTBObliqueLS: Examples: " << (int)examples_selection.size()
|
|
|
<< ", Depth: " << (int)depth << ", Entropy: " << e << std::endl;
|
|
|
-#endif
|
|
|
|
|
|
|
|
|
DecisionNode *node = new DecisionNode ();
|
|
@@ -385,7 +383,7 @@ DecisionNode *DTBObliqueLS::buildRecursive(
|
|
|
|
|
|
|
|
|
NICE::Matrix X;
|
|
|
- NICE::Vector y, beta, weights;
|
|
|
+ NICE::Vector y, params, weights;
|
|
|
getDataAndLabel( fp, examples, examples_selection, X, y, weights );
|
|
|
|
|
|
|
|
@@ -401,9 +399,7 @@ DecisionNode *DTBObliqueLS::buildRecursive(
|
|
|
negClass = posClass;
|
|
|
|
|
|
while ( posClass == negClass )
|
|
|
- {
|
|
|
negClass = rand() % (maxClassNo+1);
|
|
|
- }
|
|
|
|
|
|
yCur = y;
|
|
|
XCur = X;
|
|
@@ -422,22 +418,22 @@ DecisionNode *DTBObliqueLS::buildRecursive(
|
|
|
temp = XTXr * XCur.transpose();
|
|
|
|
|
|
|
|
|
- beta.multiply(temp,yCur,false);
|
|
|
+ params.multiply(temp,yCur,false);
|
|
|
|
|
|
|
|
|
- f->setParameterVector( beta );
|
|
|
+ f->setParameterVector( params );
|
|
|
|
|
|
|
|
|
values.clear();
|
|
|
f->calcFeatureValues( examples, examples_selection, values);
|
|
|
|
|
|
|
|
|
- findBestSplitThreshold ( values, bestSplitInfo, beta, e, maxClassNo );
|
|
|
+ findBestSplitThreshold ( values, bestSplitInfo, params, e, maxClassNo );
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
if (bestSplitInfo.entropyLeft < 1.0e-10 ) bestSplitInfo.entropyLeft = 0.0;
|