[mlpack-svn] r14969 - mlpack/trunk/src/mlpack/methods/fastmks
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Sat Apr 27 23:31:26 EDT 2013
Author: rcurtin
Date: 2013-04-27 23:31:26 -0400 (Sat, 27 Apr 2013)
New Revision: 14969
Modified:
mlpack/trunk/src/mlpack/methods/fastmks/fastmks_rules.hpp
mlpack/trunk/src/mlpack/methods/fastmks/fastmks_rules_impl.hpp
Log:
Clean up rules file a little bit; make BaseCase forced inline.
Modified: mlpack/trunk/src/mlpack/methods/fastmks/fastmks_rules.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/fastmks/fastmks_rules.hpp 2013-04-27 22:54:54 UTC (rev 14968)
+++ mlpack/trunk/src/mlpack/methods/fastmks/fastmks_rules.hpp 2013-04-28 03:31:26 UTC (rev 14969)
@@ -13,6 +13,9 @@
namespace mlpack {
namespace fastmks {
+/**
+ * The base case and pruning rules for FastMKS (fast max-kernel search).
+ */
template<typename KernelType, typename TreeType>
class FastMKSRules
{
@@ -105,15 +108,19 @@
const double oldScore) const;
private:
+ //! The reference dataset.
const arma::mat& referenceSet;
-
+ //! The query dataset.
const arma::mat& querySet;
+ //! The indices of the maximum kernel results.
arma::Mat<size_t>& indices;
-
+ //! The maximum kernels.
arma::mat& products;
- arma::vec queryKernels; // || q || for each q.
+ //! Cached query set self-kernels (|| q || for each q).
+ arma::vec queryKernels;
+ //! Cached reference set self-kernels (|| r || for each r).
arma::vec referenceKernels;
//! The instantiated kernel.
@@ -122,6 +129,7 @@
//! Calculate the bound for a given query node.
double CalculateBound(TreeType& queryNode) const;
+ //! Utility function to insert neighbor into list of results.
void InsertNeighbor(const size_t queryIndex,
const size_t pos,
const size_t neighbor,
Modified: mlpack/trunk/src/mlpack/methods/fastmks/fastmks_rules_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/fastmks/fastmks_rules_impl.hpp 2013-04-27 22:54:54 UTC (rev 14968)
+++ mlpack/trunk/src/mlpack/methods/fastmks/fastmks_rules_impl.hpp 2013-04-28 03:31:26 UTC (rev 14969)
@@ -38,6 +38,7 @@
}
template<typename KernelType, typename TreeType>
+inline force_inline
double FastMKSRules<KernelType, TreeType>::BaseCase(
const size_t queryIndex,
const size_t referenceIndex)
@@ -199,7 +200,7 @@
// (4) B(parent of queryNode);
double worstPointKernel = DBL_MAX;
double bestAdjustedPointKernel = -DBL_MAX;
- double bestPointSelfKernel = -DBL_MAX;
+// double bestPointSelfKernel = -DBL_MAX;
const double queryDescendantDistance = queryNode.FurthestDescendantDistance();
// Loop over all points in this node to find the best and worst.
More information about the mlpack-svn
mailing list