فهرست منبع

FPCRandomForests: minor fixes for debugging

Sven Sickert 10 سال پیش
والد
کامیت
fcd3d0abdd

+ 4 - 5
classifier/fpclassifier/randomforest/FPCRandomForests.cpp

@@ -229,7 +229,7 @@ int FPCRandomForests::classify_optimize(Example & pce)
 
 void FPCRandomForests::train(FeaturePool & fp, Examples & examples)
 {
-    fprintf (stderr,"FPCRandomForests::train()\n");
+
 	assert(builder != NULL);
 
 	if (maxClassNo < 0)
@@ -250,9 +250,8 @@ void FPCRandomForests::train(FeaturePool & fp, Examples & examples)
 
 	if (weight_examples)
 	{
-		for (Examples::iterator i = examples.begin();
-							i != examples.end();
-							i++, index++)
+        for ( Examples::iterator i = examples.begin();
+             i != examples.end(); i++, index++ )
 			i->second.weight = examples.size() / example_distribution[i->first];
 	}
 
@@ -305,7 +304,7 @@ void FPCRandomForests::train(FeaturePool & fp, Examples & examples)
 			else
 				trainingExamples = (int)(examples_index.size() * samples_per_tree);
 		
-			fprintf (stderr, "FPCRandomForests: selection of %d examples for each tree\n", trainingExamples );
+            fprintf (stderr, "FPCRandomForests: selection of %d examples for each tree (classno: %d)\n", trainingExamples, j->first );
 		
 			if ( (trainingExamples < 3) && ((int)examples_index.size() > trainingExamples) )
 			{

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

@@ -116,13 +116,13 @@ class FPCRandomForests : public FeaturePoolClassifier
     const std::vector<DecisionTree *> & getForest () const
     {
       return forest;
-    };
+    }
 
     /** direct write access to all trees */
     std::vector<DecisionTree *> & getForestNonConst ()
     {
       return forest;
-    };
+    }
 
     /** clone this object */
     FeaturePoolClassifier *clone () const;
@@ -131,7 +131,7 @@ class FPCRandomForests : public FeaturePoolClassifier
     std::vector<std::pair<double, int> > & getOutOfBagResults ()
     {
       return oobResults;
-    };
+    }
 
     /** set the number of trees */
     void setComplexity ( int size );