<p>In <a href="https://github.com/mlpack/mlpack/pull/523#discussion_r60354949">src/mlpack/core/util/split_data.hpp</a>:</p>
<pre style='color:#555'>&gt; + *arma::arma_rng::set_seed(100); //set the seed if you like
&gt; + *TrainTestSplit(input, label, trainData,
&gt; + *               testData, trainLabel, testLabel);
&gt; + *@endcode
&gt; + */
&gt; +template&lt;typename T, typename U&gt;
&gt; +void TrainTestSplit(arma::Mat&lt;T&gt; const &amp;input,
&gt; +                    arma::Row&lt;U&gt; const &amp;inputLabel,
&gt; +                    arma::Mat&lt;T&gt; &amp;trainData,
&gt; +                    arma::Mat&lt;T&gt; &amp;testData,
&gt; +                    arma::Row&lt;U&gt; &amp;trainLabel,
&gt; +                    arma::Row&lt;U&gt; &amp;testLabel,
&gt; +                    double const testRatio)
&gt; +{
&gt; +  size_t const testSize =
&gt; +      static_cast&lt;size_t&gt;(input.n_cols * testRatio);
</pre>
<p>Because the compiler may give you type cast warning if you do not add static_cast</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 or <a href="https://github.com/mlpack/mlpack/pull/523/files/c92dd2fc6561b1cf40efb744dcc9233bc3675c91#r60354949">view it on GitHub</a><img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFHbiDUbhble6iWdM67VEVVU5bwtiks5p5cXOgaJpZM4HhWF3.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/523/files/c92dd2fc6561b1cf40efb744dcc9233bc3675c91#r60354949"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>