[mlpack-git] mlpack-1.0.x: Backport r17274. (9acb6e4)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:06:17 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : mlpack-1.0.x
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit 9acb6e49ff2a0315c6a01cf67acd3bb0ae29dd5d
Author: Ryan Curtin <ryan at ratml.org>
Date: Sun Dec 7 19:21:09 2014 +0000
Backport r17274.
>---------------------------------------------------------------
9acb6e49ff2a0315c6a01cf67acd3bb0ae29dd5d
HISTORY.txt | 3 +++
src/mlpack/core/metrics/mahalanobis_distance.hpp | 6 ++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/HISTORY.txt b/HISTORY.txt
index 81ed204..4715b70 100644
--- a/HISTORY.txt
+++ b/HISTORY.txt
@@ -8,6 +8,9 @@
* Add support for observation weights to LinearRegression.
+ * MahalanobisDistance<> now takes root of the distance by default and
+ therefore satisfies the triangle inequality (TakeRoot now defaults to true).
+
2014-08-29 mlpack 1.0.10
* Bugfix for NeighborSearch regression which caused very slow allknn/allkfn.
diff --git a/src/mlpack/core/metrics/mahalanobis_distance.hpp b/src/mlpack/core/metrics/mahalanobis_distance.hpp
index d7631b2..530cc0a 100644
--- a/src/mlpack/core/metrics/mahalanobis_distance.hpp
+++ b/src/mlpack/core/metrics/mahalanobis_distance.hpp
@@ -55,9 +55,11 @@ namespace metric {
* which is faster to evaluate.
*
* @tparam TakeRoot If true, takes the root of the output. It is slightly
- * faster to leave this at the default of false.
+ * faster to leave this at the default of false, but this means the metric may
+ * not satisfy the triangle inequality and may not be usable for methods that
+ * expect a true metric.
*/
-template<bool TakeRoot = false>
+template<bool TakeRoot = true>
class MahalanobisDistance
{
public:
More information about the mlpack-git
mailing list