Skip to content
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

FPS sample selection in the tutorial #156

Open
SanggyuChong opened this issue Feb 10, 2023 · 3 comments
Open

FPS sample selection in the tutorial #156

SanggyuChong opened this issue Feb 10, 2023 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@SanggyuChong
Copy link

Hello,

I'd like to suggest the addition of a function, to the tutorial, that performs farthest point selection for the atomic environments as one prepares for the construction of sparse kernel models. @PicoCentauri have kindly provided me with the code below, which, again, we think could be a nice addition to the tutorial:

def fps_sample_selection(descriptor, n_to_select):

    blocks = []
    for _, block in descriptor:
        # create a separate FPS selector for each block
        fps = FPS(n_to_select=n_to_select)
        mask = fps.fit(block.values.T).get_support()
        selected_samples = block.samples[mask]
        # The only important data here is the properties, so we create empty
        # sets of samples and components.
        blocks.append(
            TensorBlock(
                values=np.empty((1, len(selected_samples))).T,
                samples=selected_samples,
                components=[],
                properties=Labels.single(),
            )
        )

    return TensorMap(descriptor.keys, blocks)

Thank you!

  • Raymond
@PicoCentauri PicoCentauri self-assigned this Feb 10, 2023
@PicoCentauri PicoCentauri added the documentation Improvements or additions to documentation label Feb 10, 2023
@Luthaf
Copy link
Owner

Luthaf commented Feb 11, 2023

That might be better inside the equistore documentation (or even equisolve, with a sparse kernel tutorial)

@PicoCentauri
Copy link
Collaborator

We can put it there once we have sparse kernels 😅

@PicoCentauri
Copy link
Collaborator

See lab-cosmo/equisolve#39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants