[mlpack-git] [mlpack/mlpack] Spill trees (#747)

Ryan Curtin notifications at github.com
Sun Aug 14 16:50:13 EDT 2016


> +    // better, then take it.
> +    if (SortPolicy::IsBetter(queryNode.Parent()->Stat().FirstBound(),
> +        worstDistance))
> +      worstDistance = queryNode.Parent()->Stat().FirstBound();
> +  }
> +
> +  // Could the existing bounds be better?
> +  if (SortPolicy::IsBetter(queryNode.Stat().FirstBound(), worstDistance))
> +    worstDistance = queryNode.Stat().FirstBound();
> +
> +  // Cache bounds for later.
> +  queryNode.Stat().FirstBound() = worstDistance;
> +
> +  worstDistance = SortPolicy::Relax(worstDistance, epsilon);
> +
> +  return worstDistance;

I believe that `CalculateBound()` is the only function that needs to be changed in the rules class; is that right?  Maybe it is better to use some standalone static method to calculate the bound for spill trees, and then something like this in `NeighborSearchRules::CalculateBound()`:

```
if (IsSpillTree<TreeType>::value)
  return CalculateSpillBound(queryNode);
```

If there are other things that differ in this class, too, it might be necessary to use this same trick there.  I see this kind of as a variant of the `#ifdef` style of making things compatible, so it's kind of hackish, but I think maybe it is better than replicating the entire class in order to change only a little functionality.  What do you think?

-- 
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/747/files/fe090ee13c7cad79e2b7eb8b6690628ba3ead1ed#r74708201
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160814/ade08b42/attachment.html>


More information about the mlpack-git mailing list