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

Simplify the __init__ of the MyScaler class #3

Closed
1 task done
pierrePalud opened this issue Dec 6, 2024 · 1 comment
Closed
1 task done

Simplify the __init__ of the MyScaler class #3

pierrePalud opened this issue Dec 6, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@pierrePalud
Copy link
Owner

pierrePalud commented Dec 6, 2024

Currently, the __init__ method of the MyScaler class is written to either

  • take a grid in input and use it to compute the mean_ and std_ vectors (used in the normalization) -- this approach currently raises an NotImplementedError().
  • take directly the mean_ and std_ vectors in input.

In the rest of the code, the mean_ and std_ are in practice loaded from a sklearn.preprocessing.StandardScaler() object and then given to initialize the MyScaler instance, which seems needlessly complicated.

To clarify the code, I suggest:

  • to remove the option of providing a grid to the __init__ (which in any case is currently not supported)
@pierrePalud pierrePalud added the enhancement New feature or request label Dec 6, 2024
@pierrePalud pierrePalud self-assigned this Dec 6, 2024
@pierrePalud
Copy link
Owner Author

I removed the option, as described above.

In addition, to avoid handling the scaling factor kappa as a special case in _from_scaled_to_lin and _from_lin_to_scaled, I changed the self.mean_ and self.std_ numpy arrays, such that if there is a kappa in the physical parameters, it should be sampled in log scale. Thus I set

  • its mean to 0
  • its std to 1 / np.log(10).

This value of the std was chosen for the common validity interval on kappa, [0.1, 10], such that in scaled space it becomes [-e, e], that is, approximately [-2.7, 2.7]. This scaled interval has a similar size as the scaled validity intervals for the other physical parameters (that are all normalized).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant