[mlpack-git] mlpack-1.0.x: Backport r17274. (4762dd0)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Wed Jan 7 11:58:25 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/0000000000000000000000000000000000000000...904762495c039e345beba14c1142fd719b3bd50e

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

commit 4762dd02f8ac464c98062b1d161fc2e4ee98ace2
Author: Ryan Curtin <ryan at ratml.org>
Date:   Sun Dec 7 19:21:09 2014 +0000

    Backport r17274.


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

4762dd02f8ac464c98062b1d161fc2e4ee98ace2
 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