Add trimmed hull with onion peeling/potato paring #155
Conversation
sjsrey
left a comment
There was a problem hiding this comment.
Really nice.
A couple of ideas/comments given in-line.
| current_knob_ix = points_hull_ixs[current_knob_on_hull] | ||
| # for the points on the hull, get the ith observation's full dataset index | ||
| trimmed.loc[current_knob_ix] = True | ||
| return ~trimmed |
There was a problem hiding this comment.
Another possible enhancement you might consider is optionally returning the sequence of hulls generated during the trimming process. A long while back, I explored the geometric and spatial properties of these nested hulls, and found that they can reveal interesting patterns in the point set structure. Never returned to this, but this excellent implementation reminded me of that. Capturing the intermediate hulls would make it possible to later analyze, visualize, or summarize the shape evolution of the dataset as it's pared down. This could be done with a simple flag likereturn_hulls=False, and if enabled, the function could return a tuple (~trimmed, hulls).


This adds
trimmed_hull()andtrim_pointset()tocentrography.py. These are built on onion peeling theory.The trimmed hull is a shape that covers p% of the points. Points are removed from the covered set by either paring or peeling.
For peeling,
For paring,
One reasonable next step would be to implement a final function like
convex_depth(X, y=None)that calculates how far you have to peel to uncoveryif provided, or the convex depth of each pointXin the dataset. I think this could be done just by extending this strategy, but it would get slow quickly unless we use the Chazelle approach.