[mlpack-git] master: warn if the dimension does not contain missing value (2df9caf)

gitdub at mlpack.org gitdub at mlpack.org
Mon Sep 26 15:35:22 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/635238ba763335f6708b5560ae6606b008fdd609...066c67040a600a4600eebc6b5e0d63dc090acb8d

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

commit 2df9caf3c64687fd06be28ee98d405289012b9d6
Author: Keon Kim <kwk236 at gmail.com>
Date:   Thu Sep 8 00:29:13 2016 -0400

    warn if the dimension does not contain missing value


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

2df9caf3c64687fd06be28ee98d405289012b9d6
 src/mlpack/core/data/map_policies/missing_policy.hpp      | 1 -
 src/mlpack/methods/preprocess/preprocess_imputer_main.cpp | 8 ++++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/core/data/map_policies/missing_policy.hpp b/src/mlpack/core/data/map_policies/missing_policy.hpp
index 9ce0d86..2ac3664 100644
--- a/src/mlpack/core/data/map_policies/missing_policy.hpp
+++ b/src/mlpack/core/data/map_policies/missing_policy.hpp
@@ -88,7 +88,6 @@ class MissingPolicy
     {
       // This string already exists in the mapping or not included in
       // the missingSet.
-      size_t& numMappings = maps[dimension].second;
       return NaN;
     }
   }
diff --git a/src/mlpack/methods/preprocess/preprocess_imputer_main.cpp b/src/mlpack/methods/preprocess/preprocess_imputer_main.cpp
index c18f31f..963ab6c 100644
--- a/src/mlpack/methods/preprocess/preprocess_imputer_main.cpp
+++ b/src/mlpack/methods/preprocess/preprocess_imputer_main.cpp
@@ -121,6 +121,14 @@ int main(int argc, char** argv)
     Log::Warn << "The file does not contain any user-defined missing "
         << "variables. The program did not perform any imputation." << endl;
   }
+  else if (CLI::HasParam("dimension") &&
+      !(std::find(dirtyDimensions.begin(), dirtyDimensions.end(), dimension)
+      != dirtyDimensions.end()))
+  {
+    Log::Warn << "The given dimension of the file does not contain any "
+      << "user-defined missing variables. The program did not perform any "
+      << "imputation." << endl;
+  }
   else
   {
     // Initialize imputer class




More information about the mlpack-git mailing list