Skip to content

Conversation

@victorprincipe
Copy link
Collaborator

Added the basic Generalised Convex Hull functionality, as outlined in A. Anelli, E. A. Engel, C. J. Pickard and M. Ceriotti, Physical Review Materials, 2018, to Sample Selection.

Copy link
Collaborator

@rosecers rosecers left a comment

Choose a reason for hiding this comment

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

Looking good so far! Left some comments.

@victorprincipe victorprincipe requested review from Luthaf and rosecers and removed request for agoscinski November 24, 2022 09:12
Copy link
Collaborator

@agoscinski agoscinski left a comment

Choose a reason for hiding this comment

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

Please merge first #146, then rebase this

@agoscinski
Copy link
Collaborator

for information: the changes in the .github/workflows/tests.yml and pyproject.toml will be gone after rebase, they are in #146

I can do the changes in the setup.cfg in a separate commit before merging. They are required because of

2022-12-08T10:58:51.8211666Z packaging.requirements.InvalidRequirement: Expected version after operator
2022-12-08T10:58:51.8212053Z     scikit-learn (>="0.24.0")

setup.cfg Outdated
Comment on lines 24 to 25
install_requires = ["numpy",
"scikit-learn>=0.24.0"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I typically use this syntax, does it not work?

Suggested change
install_requires = ["numpy",
"scikit-learn>=0.24.0"]
install_requires =
numpy
scikit-learn>=0.24.0

Copy link
Collaborator

@rosecers rosecers left a comment

Choose a reason for hiding this comment

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

In general looks good, but would love to hear the reasoning behind the templating before approval.

@agoscinski agoscinski requested a review from rosecers December 8, 2022 13:55
Copy link
Collaborator

@rosecers rosecers 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! Please separate off the non-relevant changes and we can merge.

@agoscinski
Copy link
Collaborator

agoscinski commented Dec 9, 2022

rebased. I have made a backup and sent to @victorprincipe in case I screwed something up

@agoscinski agoscinski requested a review from rosecers December 9, 2022 09:38
@rosecers
Copy link
Collaborator

Weren't there tests in here as well? Please make sure that there is proper code coverage.

@agoscinski
Copy link
Collaborator

Weren't there tests in here as well? Please make sure that there is proper code coverage.

My bad, forgot to add them on rebase. Now they are added. Will request review as soon test run through.

@agoscinski
Copy link
Collaborator

@rosecers okay seems to work now

@agoscinski
Copy link
Collaborator

We would squash everything to one commit

    Implementation of DirectionalConvexHull
    
    * implements the class DirectionalConvexHull in the sample selection
    submodule
    
    * implements tests for the class DirectionalConvexHull

features (i.e. those not used for the convex hull
construction)
vertices_idx_ : numpy.ndarray
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we deviate from the convention of the other selectors? I.e. why is this not 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.

right, renamed it

self.n_features_in_ = X.shape[1]

if len(y.shape) == 1:
y = y.reshape((len(y), 1))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want this to work for y.shape[1]!=0? If not there should be a check here

Copy link
Collaborator

Choose a reason for hiding this comment

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

the case y.shape = (n_samples, 1) is allowed
the case y.shape = (n_samples, >1) is checked by the check_X_y (argument multioutput is False by default)

I put the flag into the check to make it more apparent

y_normal = convex_hull.equations[:, 0]

# get vertices_idx of the convex hull
vertices_idx = np.unique(
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment as above


def _check_is_fitted(self, X):
check_is_fitted(
self, ["high_dim_idx_", "interpolator_high_dim_", "interpolator_y_"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

should also have vertices_idx_ or equivalent

Copy link
Collaborator

Choose a reason for hiding this comment

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

added

if np.any(np.isnan(interpolated_high_dim_feats)):
warnings.warn(
"There are samples in X with a low-dimensional part that is outside of the range of the convex surface. Distance will contain nans.",
UserWarning,
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍🏻

agoscinski added a commit that referenced this pull request Jan 31, 2023
@agoscinski
Copy link
Collaborator

Besides comments, I changed one more thing

    change minimum scikit-learn version to 1.1
    
    see discussion https://github.com/lab-cosmo/scikit-cosmo/pull/140#discussion_r1042238012

I would put this in a separate commit when rebasing

@agoscinski agoscinski requested a review from rosecers January 31, 2023 06:11
* implements the class DirectionalConvexHull in the sample selection
    submodule

* implements tests for the class DirectionalConvexHull.
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.

5 participants