[mlpack-git] [mlpack/mlpack] Universal B tree implementation (#746)

Ryan Curtin notifications at github.com
Wed Aug 17 20:04:45 EDT 2016


> +                                                const size_t begin,
> +                                                const size_t count,
> +                                                size_t& splitCol)
> +{
> +  constexpr size_t order = sizeof(AddressElemType) * CHAR_BIT;
> +  if (begin == 0 && count == data.n_cols)
> +  {
> +    // Calculate all addresses.
> +    InitializeAddresses(data);
> +
> +    // Probably this is not a good idea. Maybe it is better to get
> +    // a number of distinct samples and find the median.
> +    std::sort(addresses.begin(), addresses.end(), ComparePair);
> +
> +    // Rearrange dataset.
> +    PerformSplit(data, count);

I think that the code could be simplified significantly if you instead used `arma::Mat<AddressElemType>` in order to store the addresses, and then used `sort_index()` to get the sorted order, which you could then apply to the data points and the addresses, and use to calculate `oldFromNew` if needed.  I think that would remove the need for `PerformSplit` altogether.

-- 
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/746/files/8c5a97dcb1641ae6c98edc70426fb19f5cd7cb79#r75229770
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160817/43c9dfa6/attachment.html>


More information about the mlpack-git mailing list