fixed #517; uncommented ertrees test and moved it to black llist
authorMaria Dimashova <no@email>
Mon, 29 Nov 2010 09:34:06 +0000 (09:34 +0000)
committerMaria Dimashova <no@email>
Mon, 29 Nov 2010 09:34:06 +0000 (09:34 +0000)
modules/ml/src/inner_functions.cpp
modules/ml/src/tree.cpp
tests/ml/src/amltests.cpp
tests/ml/src/mltest_main.cpp

index eaf70d4d275a3fc8eb502836db486b0918c3ad9a..00595975ec9579ab5f92cd51f49b49742ce4af40 100644 (file)
@@ -431,8 +431,6 @@ cvPreprocessIndexArray( const CvMat* idx_arr, int data_arr_size, bool check_for_
         if( idx_selected == 0 )
             CV_ERROR( CV_StsOutOfRange, "No components/input_variables is selected!" );
 
-        //if( idx_selected == idx_total )
-        //    EXIT;
         break;
     case CV_32SC1:
         // idx_arr is array of integer indices of selected components
index fd757384405822f53ede5ded4fe94fe56c3cdd0f..dcc54f682e8e6d2aafc1922a54547d2362d534b4 100644 (file)
@@ -666,6 +666,8 @@ CvDTreeNode* CvDTreeTrainData::subsample_data( const CvMat* _subsample_idx )
     CvMat* isubsample_idx = 0;
     CvMat* subsample_co = 0;
 
+    bool isMakeRootCopy = true;
+
     CV_FUNCNAME( "CvDTreeTrainData::subsample_data" );
 
     __BEGIN__;
@@ -674,9 +676,26 @@ CvDTreeNode* CvDTreeTrainData::subsample_data( const CvMat* _subsample_idx )
         CV_ERROR( CV_StsError, "No training data has been set" );
 
     if( _subsample_idx )
+    {
         CV_CALL( isubsample_idx = cvPreprocessIndexArray( _subsample_idx, sample_count ));
 
-    if( !isubsample_idx )
+        if( isubsample_idx->cols + isubsample_idx->rows - 1 == sample_count )
+        {
+            const int* sidx = isubsample_idx->data.i;
+            for( int i = 0; i < sample_count; i++ )
+            {
+                if( sidx[i] != i )
+                {
+                    isMakeRootCopy = false;
+                    break;
+                }
+            }
+        }
+        else
+            isMakeRootCopy = false;
+    }
+
+    if( isMakeRootCopy )
     {
         // make a copy of the root node
         CvDTreeNode temp;
@@ -1588,7 +1607,7 @@ bool CvDTree::do_train( const CvMat* _subsample_idx )
     CV_CALL( try_split_node(root));
 
     if( data->params.cv_folds > 0 )
-        CV_CALL( prune_cv());
+        CV_CALL( prune_cv() );
 
     if( !data->shared )
         data->free_train_data();
index 43f8062d9b70a00d6eb127464c2a882b28dd324d..c4bd3f7fa03041f42439468cca48f80a8e3a9974 100644 (file)
@@ -118,6 +118,6 @@ int CV_AMLTest::validate_test_results( int testCaseIdx )
 CV_AMLTest amldtree( CV_DTREE, "adtree" );\r
 CV_AMLTest amlboost( CV_BOOST, "aboost" );\r
 CV_AMLTest amlrtrees( CV_RTREES, "artrees" );\r
-//CV_AMLTest amlertrees( CV_ERTREES, "aertrees" );\r
+CV_AMLTest amlertrees( CV_ERTREES, "aertrees" );\r
 \r
 /* End of file. */\r
index 1e8c59cedea1cce08e7c4ed6a0573cc0a3eeb0bc..b40f7a4f935df5623389bb0c8644c02d1f1d2ee5 100644 (file)
@@ -48,6 +48,7 @@ const char* blacklist[] =
     "adtree",          //ticket 662
     "artrees",         //ticket 460
     "aboost",          //ticket 474
+    "aertrees",
     0
 };