Skip to content

Commit

Permalink
fixed stuff again
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.pointclouds.org/pcl/trunk@8286 a9d63959-f2ad-4865-b262-bf0e56cfafb6
  • Loading branch information
Stefan Holzer committed Dec 18, 2012
1 parent ad0260c commit f7b8625
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ml/include/pcl/ml/impl/dt/decision_tree_trainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pcl::DecisionTreeTrainer<FeatureType, DataSet, LabelType, ExampleIndex, NodeType
, data_set_ ()
, label_data_ ()
, examples_ ()
, decision_tree_trainer_data_provider_ ()
, random_features_at_split_node_(false)
{

Expand Down Expand Up @@ -77,8 +78,10 @@ pcl::DecisionTreeTrainer<FeatureType, DataSet, LabelType, ExampleIndex, NodeType
NodeType root_node;
tree.setRoot (root_node);

if (decision_tree_trainer_data_provider_ != 0)
if (decision_tree_trainer_data_provider_)
{
std::cerr << "use decision_tree_trainer_data_provider_" << std::endl;

decision_tree_trainer_data_provider_->getDatasetAndLabels (data_set_, label_data_, examples_);
trainDecisionTreeNode (features, examples_, label_data_, max_tree_depth_, tree.getRoot ());
label_data_.clear ();
Expand All @@ -105,7 +108,7 @@ pcl::DecisionTreeTrainer<FeatureType, DataSet, LabelType, ExampleIndex, NodeType
const size_t num_of_examples = examples.size ();
if (num_of_examples == 0)
{
PCL_ERROR ("Reached invalid point in decision tree training");
PCL_ERROR ("Reached invalid point in decision tree training: Number of examples is 0!");
return;
};

Expand Down Expand Up @@ -217,7 +220,7 @@ pcl::DecisionTreeTrainer<FeatureType, DataSet, LabelType, ExampleIndex, NodeType
flags,
best_feature_threshold,
branch_indices);
}
}

stats_estimator_->computeAndSetNodeStats (data_set_, examples, label_data, node);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ namespace pcl
else
scale = static_cast<float> (data_set (example.data_set_id, center_col_index, center_row_index)[SCALE_CHANNEL]);




const size_t p1_col = static_cast<size_t> (scale * feature.p1.x + center_col_index);
const size_t p1_row = static_cast<size_t> (scale * feature.p1.y + center_row_index);

Expand Down
17 changes: 17 additions & 0 deletions ml/include/pcl/ml/multi_channel_2d_data_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ namespace pcl
width_ = width;
height_ = height;
}

/** \brief Clears the internal data storage and sets width and height to 0.
*/
void
clear ()
{
width_ = 0;
height_ = 0;
data_.clear ();
}

/** \brief Returns a pointer to the internal data at the specified location.
* \param[in] col_index The column index.
Expand Down Expand Up @@ -157,6 +167,13 @@ namespace pcl
}
}

/** \brief Releases the data stored in the data set. */
void
clear ()
{
releaseDataSet ();
}

/** \brief Returns a pointer to the specified data block at the specified location.
* \param[in] data_set_id The index of the data block.
* \param[in] col The column of the desired location.
Expand Down

0 comments on commit f7b8625

Please sign in to comment.