-
Notifications
You must be signed in to change notification settings - Fork 21
Fixing negative distances for fitted points with the DirectionalConvexHull #165
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
Conversation
skmatter/sample_selection/_base.py
Outdated
@@ -399,6 +399,15 @@ def __init__( | |||
) | |||
|
|||
|
|||
def directional_distance(equations, points): |
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.
Would be nice if we add here explanation for math. I did not find this trivial at all
skmatter/sample_selection/_base.py
Outdated
@@ -565,17 +598,46 @@ def score_samples(self, X, y): | |||
|
|||
# features used for the convex hull construction | |||
low_dim_feats = X[:, self.low_dim_idx] | |||
hull_space_feats = np.hstack((y.reshape(-1, 1), low_dim_feats)) |
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.
Should use "hull_space_data" for consistency with fit function
skmatter/sample_selection/_base.py
Outdated
] | ||
|
||
self.selected_idx_ = np.unique(self.directional_simplices_.flatten()) | ||
self.directional_points_ = convex_hull_data[self.selected_idx_] |
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.
Should probably be a hidden variable no?
convex_hull.simplices[np.where(y_normal < 0)[0]].flatten() | ||
) | ||
directional_facets_idx = np.where(y_normal < 0)[0] | ||
self.directional_simplices_ = self.convex_hull_.simplices[ |
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.
should probably be a hidden variable, no?
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.
Looks good
a9bc50c
to
96a2596
Compare
Fixing #162
First commit adds a test that fails with the current way distances to the convex hull are computed in main, the second commit changes to a different way of computing the distances to the convex hull that run with the tests