[mlpack-git] [mlpack/mlpack] add train test split (#523)

Marcus Edel notifications at github.com
Mon Apr 18 12:58:56 EDT 2016


> + *arma::arma_rng::set_seed(100); //set the seed if you like
> + *TrainTestSplit(input, label, trainData,
> + *               testData, trainLabel, testLabel);
> + *@endcode
> + */
> +template<typename T, typename U>
> +void TrainTestSplit(arma::Mat<T> const &input,
> +                    arma::Row<U> const &inputLabel,
> +                    arma::Mat<T> &trainData,
> +                    arma::Mat<T> &testData,
> +                    arma::Row<U> &trainLabel,
> +                    arma::Row<U> &testLabel,
> +                    double const testRatio)
> +{
> +  size_t const testSize =
> +      static_cast<size_t>(input.n_cols * testRatio);

I'm not sure why we need an static_cast here. I guess it's because we can check the type at compile-time?

---
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/523/files/c92dd2fc6561b1cf40efb744dcc9233bc3675c91#r60094318
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160418/206359ee/attachment-0001.html>


More information about the mlpack-git mailing list