[mlpack-svn] r14404 - in mlpack/trunk/src/mlpack/core/tree: binary_space_tree cover_tree
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Feb 26 18:07:31 EST 2013
Author: rcurtin
Date: 2013-02-26 18:07:31 -0500 (Tue, 26 Feb 2013)
New Revision: 14404
Modified:
mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp
Log:
Update statistic API; for cover trees, actually call the initializer.
Modified: mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp 2013-02-26 23:07:01 UTC (rev 14403)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp 2013-02-26 23:07:31 UTC (rev 14404)
@@ -35,10 +35,7 @@
SplitNode(data);
// Create the statistic depending on if we are a leaf or not.
- if (IsLeaf())
- stat = StatisticType(data, begin, count);
- else
- stat = StatisticType(data, begin, count, left->Stat(), right->Stat());
+ stat = StatisticType(*this);
}
template<typename BoundType, typename StatisticType, typename MatType>
@@ -64,10 +61,7 @@
SplitNode(data, oldFromNew);
// Create the statistic depending on if we are a leaf or not.
- if (IsLeaf())
- stat = StatisticType(data, begin, count);
- else
- stat = StatisticType(data, begin, count, left->Stat(), right->Stat());
+ stat = StatisticType(*this);
}
template<typename BoundType, typename StatisticType, typename MatType>
@@ -94,10 +88,7 @@
SplitNode(data, oldFromNew);
// Create the statistic depending on if we are a leaf or not.
- if (IsLeaf())
- stat = StatisticType(data, begin, count);
- else
- stat = StatisticType(data, begin, count, left->Stat(), right->Stat());
+ stat = StatisticType(*this);
// Map the newFromOld indices correctly.
newFromOld.resize(data.n_cols);
@@ -125,10 +116,7 @@
SplitNode(data);
// Create the statistic depending on if we are a leaf or not.
- if (IsLeaf())
- stat = StatisticType(data, begin, count);
- else
- stat = StatisticType(data, begin, count, left->Stat(), right->Stat());
+ stat = StatisticType(*this);
}
template<typename BoundType, typename StatisticType, typename MatType>
@@ -156,10 +144,7 @@
SplitNode(data, oldFromNew);
// Create the statistic depending on if we are a leaf or not.
- if (IsLeaf())
- stat = StatisticType(data, begin, count);
- else
- stat = StatisticType(data, begin, count, left->Stat(), right->Stat());
+ stat = StatisticType(*this);
}
template<typename BoundType, typename StatisticType, typename MatType>
@@ -188,10 +173,7 @@
SplitNode(data, oldFromNew);
// Create the statistic depending on if we are a leaf or not.
- if (IsLeaf())
- stat = StatisticType(data, begin, count);
- else
- stat = StatisticType(data, begin, count, left->Stat(), right->Stat());
+ stat = StatisticType(*this);
// Map the newFromOld indices correctly.
newFromOld.resize(data.n_cols);
Modified: mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp 2013-02-26 23:07:01 UTC (rev 14403)
+++ mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp 2013-02-26 23:07:31 UTC (rev 14404)
@@ -193,6 +193,9 @@
if (localMetric)
delete metric;
+
+ // Initialize statistic.
+ stat = StatisticType(*this);
}
template<typename MetricType, typename RootPointPolicy, typename StatisticType>
@@ -259,6 +262,9 @@
// [ far | all used ].
SortPointSet(indices, distances, 0, usedSetSize, farSetSize);
+ // Initialize the statistic.
+ stat = StatisticType(*this);
+
return;
}
@@ -429,6 +435,9 @@
furthestDescendantDistance = distances[i];
Log::Assert(furthestDescendantDistance <= pow(base, scale + 1));
+
+ // Lastly, initialize the statistic.
+ stat = StatisticType(*this);
}
// Manually create a cover tree node.
@@ -449,7 +458,8 @@
parentDistance(parentDistance),
furthestDescendantDistance(furthestDescendantDistance)
{
- // Nothing to do.
+ // Initialize the statistic.
+ stat = StatisticType(*this);
}
template<typename MetricType, typename RootPointPolicy, typename StatisticType>
More information about the mlpack-svn
mailing list