[mlpack-git] [mlpack/mlpack] Random projection trees (#726)
Ryan Curtin
notifications at github.com
Fri Aug 5 10:30:59 EDT 2016
> + ElemType length = metric::EuclideanDistance::Evaluate(origin, direction);
> +
> + if (length > 0)
> + direction /= length;
> + else
> + {
> + // If the vector is equal to 0, choose an arbitrary dimension.
> + size_t k = math::RandInt(direction.n_rows);
> +
> + direction[k] = 1.0;
> +
> + length = metric::EuclideanDistance::Evaluate(origin, direction);
> +
> + direction[k] /= length;
> + }
> +}
I think this also can be replaced with the shorter function idea I sketched in another comment. Another thought is, since you are using it twice, maybe mark the function static in `RPTreeMaxSplit` and then call it from `RPTreeMeanSplit` instead of implementing it again here. I am not sure this is a great function to add to the core mlpack code, because of its odd behavior when a vector of length 0 is selected. Is that behavior the best thing to do here, or maybe is it better to simply draw a random vector again?
---
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/726/files/e14a26f3e209af0608cb61ecaa5e30f253e72e9b#r73701401
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160805/97426d20/attachment-0001.html>
More information about the mlpack-git
mailing list