[mlpack-git] master: Fix traits, other slight bugs. I'm not sure this is ready for production yet. (46831bd)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Wed Apr 22 16:32:39 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/8f85309ae9be40e819b301b39c9a940aa28f3bb2...57d0567dddff01feea73b348f38cc040dc3cf8e3
>---------------------------------------------------------------
commit 46831bd5137203626d1793260c91cf9090364be4
Author: ryan <ryan at ratml.org>
Date: Wed Apr 22 14:19:40 2015 -0400
Fix traits, other slight bugs.
I'm not sure this is ready for production yet.
>---------------------------------------------------------------
46831bd5137203626d1793260c91cf9090364be4
src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp | 6 +++---
src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp | 2 +-
src/mlpack/core/tree/rectangle_tree/traits.hpp | 8 +++++---
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp b/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
index ec92bb3..95189db 100644
--- a/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
@@ -92,7 +92,7 @@ class RectangleTree
//! The discance to the furthest descendant, cached to speed things up.
double furthestDescendantDistance;
//! The dataset.
- MatType& dataset;
+ const MatType& dataset;
//! The mapping to the dataset
std::vector<size_t> points;
//! The local dataset
@@ -124,7 +124,7 @@ class RectangleTree
* @param firstDataIndex The index of the first data point. UNUSED UNLESS WE
* ADD SUPPORT FOR HAVING A "CENTERAL" DATA MATRIX.
*/
- RectangleTree(MatType& data,
+ RectangleTree(const MatType& data,
const size_t maxLeafSize = 20,
const size_t minLeafSize = 8,
const size_t maxNumChildren = 5,
@@ -305,7 +305,7 @@ class RectangleTree
//! Get the dataset which the tree is built on.
const arma::mat& Dataset() const { return dataset; }
//! Modify the dataset which the tree is built on. Be careful!
- arma::mat& Dataset() { return dataset; }
+ arma::mat& Dataset() { return const_cast<arma::mat&>(dataset); }
//! Get the points vector for this node.
const std::vector<size_t>& Points() const { return points; }
diff --git a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
index 01e24bd..7981dcf 100644
--- a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
@@ -22,7 +22,7 @@ template<typename SplitType,
typename StatisticType,
typename MatType>
RectangleTree<SplitType, DescentType, StatisticType, MatType>::RectangleTree(
- MatType& data,
+ const MatType& data,
const size_t maxLeafSize,
const size_t minLeafSize,
const size_t maxNumChildren,
diff --git a/src/mlpack/core/tree/rectangle_tree/traits.hpp b/src/mlpack/core/tree/rectangle_tree/traits.hpp
index 46848b9..069f417 100644
--- a/src/mlpack/core/tree/rectangle_tree/traits.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/traits.hpp
@@ -18,9 +18,11 @@ namespace tree {
* help write tree-independent (but still optimized) tree-based algorithms. See
* mlpack/core/tree/tree_traits.hpp for more information.
*/
-template<typename StatisticType,
+template<typename SplitType,
+ typename DescentType,
+ typename StatisticType,
typename MatType>
-class TreeTraits<RectangleTree<StatisticType, MatType> >
+class TreeTraits<RectangleTree<SplitType, DescentType, StatisticType, MatType> >
{
public:
/**
@@ -43,7 +45,7 @@ class TreeTraits<RectangleTree<StatisticType, MatType> >
* THIS MAY NOT BE TRUE. IT'S HARD TO DYNAMICALLY INSERT POINTS
* AND REARRANGE THE MATRIX
*/
- static const bool RearrangesDataset = true;
+ static const bool RearrangesDataset = false;
};
}; // namespace tree
More information about the mlpack-git
mailing list