[mlpack-git] master: Fix formula: we should be using the absolute value of the cosine. (0be5c05)
gitdub at mlpack.org
gitdub at mlpack.org
Sun Aug 7 16:54:44 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/b8de1faab0e58ff734dba4826c3a9607bcb6c84e...5bd1e7cf7e0cdc545fe06aef98ce1a1f051b976c
>---------------------------------------------------------------
commit 0be5c054c6e94c5f1441f8483d8e5c0db8c9010c
Author: Ryan Curtin <ryan at ratml.org>
Date: Sun Aug 7 16:26:12 2016 -0400
Fix formula: we should be using the absolute value of the cosine.
>---------------------------------------------------------------
0be5c054c6e94c5f1441f8483d8e5c0db8c9010c
src/mlpack/core/tree/cosine_tree/cosine_tree.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/mlpack/core/tree/cosine_tree/cosine_tree.cpp b/src/mlpack/core/tree/cosine_tree/cosine_tree.cpp
index e3a3015..2940608 100644
--- a/src/mlpack/core/tree/cosine_tree/cosine_tree.cpp
+++ b/src/mlpack/core/tree/cosine_tree/cosine_tree.cpp
@@ -413,8 +413,9 @@ void CosineTree::CalculateCosines(arma::vec& cosines)
}
else
{
- cosines(i) = arma::norm_dot(dataset.col(indices[splitPointIndex]),
- dataset.col(indices[i]));
+ cosines(i) =
+ std::abs(arma::norm_dot(dataset.col(indices[splitPointIndex]),
+ dataset.col(indices[i])));
}
}
}
More information about the mlpack-git
mailing list