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

Make IdentityLibrary a subclass of PolynomialLibrary #455

Open
Jacob-Stevens-Haas opened this issue Jan 9, 2024 · 0 comments
Open

Make IdentityLibrary a subclass of PolynomialLibrary #455

Jacob-Stevens-Haas opened this issue Jan 9, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@Jacob-Stevens-Haas
Copy link
Collaborator

Jacob-Stevens-Haas commented Jan 9, 2024

Doesn't add any features or applicability, but cuts out ~100 lines of code. But as I work with the library a lot, I really appreciate less to navigate through. As a slight bonus, it makes type compatibility clearer as we slowly add annotations.

An IdentityLibrary is just a degree 1 PolynomialLibrary with no bias term.

This should just call super().__init__() with the proper terms (degree, etc). Then the class should be moved to optimizers/base.py

Or it can simply become a factory function for calling PoynomialLibrary with the correct arguments. It seems like the main factor is type safety. Would love to have this discussion if anyone's interested, but I don't trust myself to think it through properly if I'm just discussing it with myself.

@Jacob-Stevens-Haas Jacob-Stevens-Haas added the good first issue Good for newcomers label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant