Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Add support in Ridge for a model with different weights per central-species #6

Open
agoscinski opened this issue Jan 25, 2023 · 0 comments

Comments

@agoscinski
Copy link
Collaborator

Problem explanation

In the case we cant to build a model with different weights per central-species, we need to build the covariance matrix different. The covariance matrix becomes instead of one n_properties x n_properties block, a block diagonal matrix with n_properties x n_properties blocks. Each block represents a different central species. For example for a dataset with only hydrogen and oxygen species, the covariance matrix would look like this

$$\begin{pmatrix} H\times H & 0\\ 0 & O\times O\end{pmatrix}$$

where the $H\times H$ and $O\times O$ are both n_properties x n_properties blocks.

Proposed solution

In these cases the central species information is stored in the keys of the TensorMap. However for Hamiltonian learning, the different keys are used for learning different entries of the Hamiltonian. The logic is different: the central-species model learns the same property for different keys (energy and its gradients) the Hamiltonian model learns different properties for each key (different entries of the Hamiltonian). Therefore we can automatically differ the two use cases from the target $y$. For the Hamiltonian learning case, the target $y$ should have the same keys as $X$ in the TensorMap. For weights per central-species $y$ still only has one key.

Possible issues with proposed solution

What is still a bit problematic, for now in Ridge we assumed that for total energy predictions the reduction of the feature matrix X to structure features happens before they are passed to the Ridge class. I am not sure if this works in the case of a model with weights per central-species. But here we need to look at the math in more detail.

@agoscinski agoscinski mentioned this issue Jan 25, 2023
4 tasks
PicoCentauri added a commit that referenced this issue Feb 8, 2023
# This is the 1st commit message:

Add Ridge class for linear models.

# This is the commit message #2:

Reduce the number of combinations tested on CI (#5)

# This is the commit message #3:

add standard scaler with tests

# This is the commit message #4:

small fixes, added TODOs to linear model

# This is the commit message #5:

format example and other files

# This is the commit message #6:

add tensor map to pickable dictionary object

# This is the commit message #7:

format example and other files

# This is the commit message #8:

Added tests

# This is the commit message #9:

skeleton for ridge test

# This is the commit message #10:

Added a shape test for Ridge + more utils

# This is the commit message #11:

fix type to int

# This is the commit message #12:

Added numerically stable solver

# This is the commit message #13:

Add tests for ridge solver: vs exact results

# This is the commit message #14:

Add test: Infinite regularization + predict

# This is the commit message #15:

changing temporray TensorMap  member variables to dicts to allow saving of model as torchscript

# This is the commit message #16:

Add test: consistent scaling of weights
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant