Skip to content

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

Merged
merged 2 commits into from
Mar 13, 2023

Conversation

agoscinski
Copy link
Collaborator

@agoscinski agoscinski commented Mar 9, 2023

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

@agoscinski agoscinski changed the title Fixing #162 Fixing negative distances for fitted points with the DirectionalConvexHull Mar 9, 2023
@@ -399,6 +399,15 @@ def __init__(
)


def directional_distance(equations, points):
Copy link
Collaborator Author

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

@@ -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))
Copy link
Collaborator

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

]

self.selected_idx_ = np.unique(self.directional_simplices_.flatten())
self.directional_points_ = convex_hull_data[self.selected_idx_]
Copy link
Collaborator

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[
Copy link
Collaborator

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?

Copy link
Collaborator

@victorprincipe victorprincipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@victorprincipe victorprincipe force-pushed the changing-dch-score-samples branch from a9bc50c to 96a2596 Compare March 13, 2023 15:32
@agoscinski agoscinski merged commit b52e992 into main Mar 13, 2023
@agoscinski agoscinski deleted the changing-dch-score-samples branch March 13, 2023 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants