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

Ryan Curtin notifications at github.com
Mon Apr 18 13:23:49 EDT 2016


> + *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);
> +  size_t const trainSize = input.n_cols - testSize;

I'd agree with this, I'd personally prefer prefix const since it's what's used everywhere.

---
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#r60098393
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160418/5fb29d5c/attachment.html>


More information about the mlpack-git mailing list