[mlpack-git] [mlpack/mlpack] Universal B tree implementation (#746)
Ryan Curtin
notifications at github.com
Mon Aug 22 16:44:04 EDT 2016
> +void CellBound<MetricType, ElemType>::AddBound(
> + const arma::Col<ElemType>& loCorner,
> + const arma::Col<ElemType>& hiCorner)
> +{
> + assert(numBounds < loBound.n_cols);
> + assert(loBound.n_rows == dim);
> + assert(loCorner.n_elem == dim);
> + assert(hiCorner.n_elem == dim);
> +
> + // If the subrectangle is not contained entirely in the outer rectangle,
> + // we shrink it.
> + for (size_t k = 0; k < dim; k++)
> + {
> + loBound(k, numBounds) = std::max(loCorner[k], bounds[k].Lo());
> +
> + hiBound(k, numBounds) = std::min(bounds[k].Hi(), hiCorner[k]);
I believe what you are doing here is, if possible, shrinking one of the UB hyperrectangles down using the minimum point-enclosing hyperrectangle. But I believe you could get a tighter bound if you instead iterated over all points, using only those that fall into this UB hyperrectangle, in order to shrink the UB hyperrectangle. I guess it is easier to demonstrate what I mean with code...
```
math::Range r(loCorner[k], hiCorner[k]);
for (size_t j = 0; j < data.n_cols; ++j)
{
if (hyperrectangle contains data.col(j))
{
r.Lo() = std::max(r.Lo(), data(k, j));
r.Hi() = std::min(r.Hi(), data(k, j));
}
}
```
The handling will become a little more tricky for operator|=(), but I believe this should help make the bounds tighter and decrease runtime. Let me know if I can clarify what I mean.
--
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/2c5eb5780226c30b8fb088ee928487f0970dc802#r75754866
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160822/597260ed/attachment.html>
More information about the mlpack-git
mailing list