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

Ryan Curtin notifications at github.com
Tue Apr 12 16:14:03 EDT 2016


> +             arma::Row<U> const &inputLabel,
> +             arma::Mat<T> &trainData,
> +             arma::Mat<T> &testData,
> +             arma::Row<U> &trainLabel,
> +             arma::Row<U> &testLabel)
> +  {
> +    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>;
> +    arma::arma_rng::set_seed(seed);

I don't think there's any need for this, we should just assume that the user has called `math::RandomSeed()` appropriately.

---
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/860256202d7cba23dd3500a05e36ecd351f1d673#r59445126
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160412/9c175a00/attachment.html>


More information about the mlpack-git mailing list