Skip to content

dev: Adopt the abstract/final pattern from Equinox #695

Description

@TobyBoyne

Hi! Thanks for all the work on GPJax, I've been enjoying getting familiar over the last couple of weeks.

When you made the switch to Equinox, did you consider adopting the abstract/final pattern? Or maybe on a smaller scale, relying more on defining fields in eqx.Module instead of custom __init__s?

I have been working with kernels, and a few small things I've noticed:

  1. My type checker thinks that instantiating a kernel with RBF() is missing parameters (eg. the compute_engine), since the defaults are provided by __init__ and not in the eqx.Module fields.
  2. Similarly, my typechecker things that RBF(name="xyz") is valid, even though it raises an error.
  3. The White kernel has a lengthscale, which is meaningless
  4. Looking at the code of StationaryKernel.__init__, it is clear that it requires some effort to fight against the Equinox internals.

I think the downstream impact of all these things is minimal - I could definitely see the argument that this isn't worth the effort.

If you are interested, I'd be very happy to make a PR to propose some changes to kernels!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions