[mlpack-git] master: zero duplicate thresh test (96895bd)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Wed Apr 29 14:43:06 EDT 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/ee384655c4462e422e343e9725437fd772ca4449...182d4a629c1b23f683dff7b284844e4e3e9f5cc4

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

commit 96895bd896b73b0709a25e7a209949c12ade5a4c
Author: HurricaneTong <HurricaneTong at HurricaneTong.local>
Date:   Wed Jan 28 11:10:33 2015 +0800

    zero duplicate thresh test


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

96895bd896b73b0709a25e7a209949c12ade5a4c
 src/mlpack/tests/mean_shift_test.cpp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/mlpack/tests/mean_shift_test.cpp b/src/mlpack/tests/mean_shift_test.cpp
index f5c071a..6088310 100644
--- a/src/mlpack/tests/mean_shift_test.cpp
+++ b/src/mlpack/tests/mean_shift_test.cpp
@@ -85,4 +85,23 @@ BOOST_AUTO_TEST_CASE(MeanShiftSimpleTest) {
   
 }
 
+/**
+ * When duplicate thresh is set to 0, any centroids shouldn't removed.
+ */
+BOOST_AUTO_TEST_CASE(ZeroDuplicateThreshTest) {
+    
+    // Set the duplicate thresh to 0
+    MeanShift<> meanShift(0);
+    
+    arma::Col<size_t> assignments;
+    arma::mat centroids;
+    meanShift.Cluster((arma::mat) trans(meanShiftData), assignments, centroids);
+    
+    /**
+     * Make sure the number of centroids is equal to 
+     * the number of vectors in dataset.
+     */
+    BOOST_REQUIRE_EQUAL(centroids.n_cols, meanShiftData.n_rows);
+}
+
 BOOST_AUTO_TEST_SUITE_END();
\ No newline at end of file



More information about the mlpack-git mailing list