[mlpack-git] master: Remove unused Score() functions. (29d4331)

gitdub at mlpack.org gitdub at mlpack.org
Thu Jun 9 09:56:44 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/28a49fa829caaf211cb9c85b013bf36fe9c1b7ba...29d43319f1a3ace534a95e966be9e903f06b07e1

>---------------------------------------------------------------

commit 29d43319f1a3ace534a95e966be9e903f06b07e1
Author: Ryan Curtin <ryan at ratml.org>
Date:   Thu Jun 9 09:56:32 2016 -0400

    Remove unused Score() functions.


>---------------------------------------------------------------

29d43319f1a3ace534a95e966be9e903f06b07e1
 src/mlpack/methods/emst/dtb_rules.hpp      | 28 ------------------
 src/mlpack/methods/emst/dtb_rules_impl.hpp | 46 ------------------------------
 2 files changed, 74 deletions(-)

diff --git a/src/mlpack/methods/emst/dtb_rules.hpp b/src/mlpack/methods/emst/dtb_rules.hpp
index 7f275cf..05fd058 100644
--- a/src/mlpack/methods/emst/dtb_rules.hpp
+++ b/src/mlpack/methods/emst/dtb_rules.hpp
@@ -38,20 +38,6 @@ class DTBRules
   double Score(const size_t queryIndex, TreeType& referenceNode);
 
   /**
-   * Get the score for recursion order, passing the base case result (in the
-   * situation where it may be needed to calculate the recursion order).  A low
-   * score indicates priority for recursion, while DBL_MAX indicates that the
-   * node should not be recursed into at all (it should be pruned).
-   *
-   * @param queryIndex Index of query point.
-   * @param referenceNode Candidate node to be recursed into.
-   * @param baseCaseResult Result of BaseCase(queryIndex, referenceNode).
-   */
-  double Score(const size_t queryIndex,
-               TreeType& referenceNode,
-               const double baseCaseResult);
-
-  /**
    * Re-evaluate the score for recursion order.  A low score indicates priority
    * for recursion, while DBL_MAX indicates that the node should not be recursed
    * into at all (it should be pruned).  This is used when the score has already
@@ -77,20 +63,6 @@ class DTBRules
   double Score(TreeType& queryNode, TreeType& referenceNode);
 
   /**
-   * Get the score for recursion order, passing the base case result (in the
-   * situation where it may be needed to calculate the recursion order).  A low
-   * score indicates priority for recursion, while DBL_MAX indicates that the
-   * node should not be recursed into at all (it should be pruned).
-   *
-   * @param queryNode Candidate query node to recurse into.
-   * @param referenceNode Candidate reference node to recurse into.
-   * @param baseCaseResult Result of BaseCase(queryIndex, referenceNode).
-   */
-  double Score(TreeType& queryNode,
-               TreeType& referenceNode,
-               const double baseCaseResult);
-
-  /**
    * Re-evaluate the score for recursion order.  A low score indicates priority
    * for recursion, while DBL_MAX indicates that the node should not be recursed
    * into at all (it should be pruned).  This is used when the score has already
diff --git a/src/mlpack/methods/emst/dtb_rules_impl.hpp b/src/mlpack/methods/emst/dtb_rules_impl.hpp
index 7fd410f..f60513b 100644
--- a/src/mlpack/methods/emst/dtb_rules_impl.hpp
+++ b/src/mlpack/methods/emst/dtb_rules_impl.hpp
@@ -93,31 +93,6 @@ double DTBRules<MetricType, TreeType>::Score(const size_t queryIndex,
 }
 
 template<typename MetricType, typename TreeType>
-double DTBRules<MetricType, TreeType>::Score(const size_t queryIndex,
-                                             TreeType& referenceNode,
-                                             const double baseCaseResult)
-{
-  // I don't really understand the last argument here
-  // It just gets passed in the distance call, otherwise this function
-  // is the same as the one above.
-  size_t queryComponentIndex = connections.Find(queryIndex);
-
-  // If the query belongs to the same component as all of the references,
-  // then prune.
-  if (queryComponentIndex == referenceNode.Stat().ComponentMembership())
-    return DBL_MAX;
-
-  const arma::vec queryPoint = dataSet.unsafe_col(queryIndex);
-  const double distance = referenceNode.MinDistance(queryPoint,
-                                                    baseCaseResult);
-
-  // If all the points in the reference node are farther than the candidate
-  // nearest neighbor for the query's component, we prune.
-  return (neighborsDistances[queryComponentIndex] < distance) ? DBL_MAX :
-      distance;
-}
-
-template<typename MetricType, typename TreeType>
 double DTBRules<MetricType, TreeType>::Rescore(const size_t queryIndex,
                                                TreeType& /* referenceNode */,
                                                const double oldScore)
@@ -149,27 +124,6 @@ double DTBRules<MetricType, TreeType>::Score(TreeType& queryNode,
 }
 
 template<typename MetricType, typename TreeType>
-double DTBRules<MetricType, TreeType>::Score(TreeType& queryNode,
-                                             TreeType& referenceNode,
-                                             const double baseCaseResult)
-{
-  // If all the queries belong to the same component as all the references
-  // then we prune.
-  if ((queryNode.Stat().ComponentMembership() >= 0) &&
-      (queryNode.Stat().ComponentMembership() ==
-           referenceNode.Stat().ComponentMembership()))
-    return DBL_MAX;
-
-  ++scores;
-  const double distance = queryNode.MinDistance(referenceNode, baseCaseResult);
-  const double bound = CalculateBound(queryNode);
-
-  // If all the points in the reference node are farther than the candidate
-  // nearest neighbor for all queries in the node, we prune.
-  return (bound < distance) ? DBL_MAX : distance;
-}
-
-template<typename MetricType, typename TreeType>
 double DTBRules<MetricType, TreeType>::Rescore(TreeType& queryNode,
                                                TreeType& /* referenceNode */,
                                                const double oldScore) const




More information about the mlpack-git mailing list