[mlpack-git] [mlpack/mlpack] Random projection trees (#726)
notifications at github.com
Fri Aug 5 10:45:40 EDT 2016
> +template<typename BoundType, typename MatType>
> +bool RPTreeMeanSplit<BoundType, MatType>::GetMeanMedian(
> + const MatType& data,
> + const arma::uvec& samples,
> + arma::Col<ElemType>& mean,
> + ElemType& splitVal)
> + std::vector<ElemType> values(samples.n_elem);
> + mean.zeros(data.n_rows);
> + for (size_t k = 0; k < samples.n_elem; k++)
> + mean += data.col(samples[k]);
> + mean /= samples.n_elem;
This is a low-priority suggestion, so if you don't have time to look into it, I don't think it will make much difference. So, I am wondering if you could use non-contiguous matrix views here to accomplish the same thing. You could do something like...
But the question is whether or not the template metaprogramming inside Armadillo will produce something equivalently fast to what you have written above, or if it will instead do something less smart, like instantiating a whole new matrix to hold the subview, and then calculating the mean for that matrix. I think you could determine this either by inspecting the Armadillo codebase or by just writing a test and comparing.
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the mlpack-git