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

Marcus Edel notifications at github.com
Mon Apr 18 13:29:21 EDT 2016


> +                    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;
> +  trainData.set_size(input.n_rows, trainSize);
> +  testData.set_size(input.n_rows, testSize);
> +  trainLabel.set_size(trainSize);
> +  testLabel.set_size(testSize);
> +
> +  using Col = arma::Col<size_t>;
> +  Col const sequence = arma::linspace<Col>(0, input.n_cols - 1,
> +                                           input.n_cols);
> +  arma::Col<size_t> const order = arma::shuffle(sequence);
> +

Okay, another highly biased and all in all picky comment from my side. I would combine line 53-56 into a single line. We don't need to store ```sequence``` right?

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


More information about the mlpack-git mailing list