<p>In <a href="https://github.com/mlpack/mlpack/pull/694#discussion_r69908461">src/mlpack/core/data/map_policies/missing_policy.hpp</a>:</p>
<pre style='color:#555'>&gt; +#include &lt;limits&gt;
&gt; +
&gt; +
&gt; +using namespace std;
&gt; +
&gt; +namespace mlpack {
&gt; +namespace data {
&gt; +
&gt; +/**
&gt; + * Same as increment map policy, but does not change type of features.
&gt; + */
&gt; +class MissingPolicy
&gt; +{
&gt; + public:
&gt; +  // typedef of mapped_type
&gt; +  using mapped_type = double;
</pre>
<p>But a problem here is that the actual mapped type is specified by the input type to <code>data::Load()</code>, which takes matrices of any type.  So even if <code>mapped_type</code> (which should be named <code>MappedType</code> by the way) is <code>double</code>, if the user passed an <code>arma::Mat&lt;size_t&gt;</code> to <code>data::Load()</code>, any NaNs that were mapped will be converted to something else when the <code>double</code> is converted to a <code>size_t</code>.</p>

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

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/694/files/a8818316a04506530e2269a2e0a32ba2f6a1c83b#r69908461">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFNWZHTmYwUAR5DuoKtoFq4mnjzYYks5qTQMWgaJpZM4I07W-">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFEwQ0Vc7zLu4cWKyfMXUWDod9NK0ks5qTQMWgaJpZM4I07W-.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/pull/694/files/a8818316a04506530e2269a2e0a32ba2f6a1c83b#r69908461"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>