-
Notifications
You must be signed in to change notification settings - Fork 30
Add trimmed hull with onion peeling/potato paring #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
sjsrey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on this.


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.