|
@@ -26,6 +26,7 @@ DTBOblique::DTBOblique ( const Config *conf, string section )
|
|
|
saveIndices = conf->gB( section, "save_indices", false);
|
|
|
useShannonEntropy = conf->gB( section, "use_shannon_entropy", false );
|
|
|
useOneVsOne = conf->gB( section, "use_one_vs_one", false );
|
|
|
+ useDynamicRegularization = conf->gB( section, "use_dynamic_regularization", true );
|
|
|
|
|
|
splitSteps = conf->gI( section, "split_steps", 20 );
|
|
|
maxDepth = conf->gI( section, "max_depth", 10 );
|
|
@@ -239,8 +240,6 @@ void DTBOblique::regularizeDataMatrix(
|
|
|
q[0] = 1.0;
|
|
|
NICE::Matrix Q;
|
|
|
Q.tensorProduct(q,q);
|
|
|
- //R.multiply(XTXreg,Q);
|
|
|
- // element-wise multiplication
|
|
|
R.resize(dim,dim);
|
|
|
for ( int r = 0; r < dim; r++ )
|
|
|
{
|
|
@@ -495,16 +494,21 @@ DecisionNode *DTBOblique::buildRecursive(
|
|
|
delete [] bestSplitInfo.distRight;
|
|
|
|
|
|
// update lambda by heuristic [Laptev/Buhmann, 2014]
|
|
|
- double lambdaLeft = lambdaCurrent *
|
|
|
+ double lambdaLeft, lambdaRight;
|
|
|
+
|
|
|
+ if (useDynamicRegularization)
|
|
|
+ {
|
|
|
+ lambdaLeft = lambdaCurrent *
|
|
|
pow(((double)examples_selection.size()/(double)examples_left.size()),(2./f->getParameterLength()));
|
|
|
- double lambdaRight = lambdaCurrent *
|
|
|
+ lambdaRight = lambdaCurrent *
|
|
|
pow(((double)examples_selection.size()/(double)examples_right.size()),(2./f->getParameterLength()));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lambdaLeft = lambdaCurrent;
|
|
|
+ lambdaRight = lambdaCurrent;
|
|
|
+ }
|
|
|
|
|
|
-//#ifdef DEBUGTREE
|
|
|
-// std::cerr << "regularization parameter lambda left " << lambdaLeft
|
|
|
-// << " right " << lambdaRight << std::endl;
|
|
|
-
|
|
|
-//#endif
|
|
|
|
|
|
/** Recursion */
|
|
|
// left child
|