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

Parameter setting behavior OrthExponentialBasis #277

Open
BalzaniEdoardo opened this issue Dec 9, 2024 · 1 comment
Open

Parameter setting behavior OrthExponentialBasis #277

BalzaniEdoardo opened this issue Dec 9, 2024 · 1 comment

Comments

@BalzaniEdoardo
Copy link
Collaborator

Dependency Between Basis Parameters

Three parameters of the basis are interdependent:

  1. n_basis_funcs: Number of basis functions.
  2. decay_rates: List of decay rates.
  3. window_size: The size of the window for basis construction.

Dependency Between n_basis_funcs and decay_rates

  • Current Behavior:

    • n_basis_funcs must equal the length of decay_rates. If this condition is not met, an error is raised in the setter of decay_rates.
    • However, users can modify n_basis_funcs first, followed by decay_rates, to avoid this error.
  • Proposed Improvement:

    • When a new list of decay_rates is provided, automatically adjust n_basis_funcs to match the length of decay_rates, as the latter inherently determines the number of basis functions.
    • The reverse (adjusting decay_rates based on n_basis_funcs) does not make sense, so errors should instead be raised in the setter for n_basis_funcs.
  • Cross-validation Implication:

    • Since the number of basis functions for exponential decay is tied to the decay rates, cross-validating decay_rates suffices for validation.

Dependency Between n_basis_funcs and window_size

  • Constraint:

    • window_size must not be smaller than n_basis_funcs for orthogonalization to work.
  • Challenge with Current Validation:

    • Raising errors in the setters can make joint cross-validation problematic:
      • If both setters check the other parameter, some parameter combination cannot be set after initialization. For example, reducing the window_size to a lower value then the initial number of basis or increasing the number of basis to a larger value than the initial window size would be impossible (e.g., reducing window_size fails due to too many basis functions, while increasing n_basis_funcs fails due to insufficient window_size).
      • If only one setter performs validation, the success or failure depends on the order in which parameters are modified.
  • Proposed Improvement:

    • Remove validation from the setters and only enforce constraints at class initialization or compute time.
    • This allows flexibility for cross-validation workflows, where only valid combinations of n_basis_funcs and window_size are used.

Summary

To ensure usability and flexibility:

  • n_basis_funcs and decay_rates: Automatically adjust n_basis_funcs when decay_rates is set, and validate in the n_basis_funcs setter.
  • n_basis_funcs and window_size: Perform validation at compute time, not in setters, to support joint cross-validation of parameters.
@billbrod
Copy link
Member

Additionally, OrthExponentialBasis performs orthogonalization inside the basis, and thus n_basis_funcs does not specify the output shape (and this is the only basis where this is the case). Instead, this basis should just be ExponentialBasis, and we the orthogonalization should happen externally

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

No branches or pull requests

2 participants