[mlpack-git] [mlpack/mlpack] DatasetMapper & Imputer (#694)

Ryan Curtin notifications at github.com
Thu Jul 7 09:45:58 EDT 2016


> +#include <limits>
> +
> +
> +using namespace std;
> +
> +namespace mlpack {
> +namespace data {
> +
> +/**
> + * Same as increment map policy, but does not change type of features.
> + */
> +class MissingPolicy
> +{
> + public:
> +  // typedef of mapped_type
> +  using mapped_type = double;

But a problem here is that the actual mapped type is specified by the input type to `data::Load()`, which takes matrices of any type.  So even if `mapped_type` (which should be named `MappedType` by the way) is `double`, if the user passed an `arma::Mat<size_t>` to `data::Load()`, any NaNs that were mapped will be converted to something else when the `double` is converted to a `size_t`.

So I think that you will have to take the type as given by `data::Load()`, and maybe then you can use a `static_assert()` to check that the given type has what you need (like for `MissingPolicy`, you need some kind of NaN).

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/694/files/a8818316a04506530e2269a2e0a32ba2f6a1c83b#r69908461
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160707/b570589c/attachment-0001.html>


More information about the mlpack-git mailing list