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

Support for Generics in Parameter class #297

Open
ekalosak opened this issue Apr 17, 2020 · 2 comments
Open

Support for Generics in Parameter class #297

ekalosak opened this issue Apr 17, 2020 · 2 comments

Comments

@ekalosak
Copy link
Contributor

Parameter[float, int, Decimal, Fraction] or even something like numeric a => Parameter[a] would be extremely helpful for validating model constructions.

@apaleyes
Copy link
Collaborator

Interesting idea, but the use isn't entirely clear. Can you give a quick conceptual example of how would you use this GenericParameter?

@ekalosak
Copy link
Contributor Author

ekalosak commented Apr 17, 2020

A = TypeVar('A', a, b)
B = Sequence[A]
class BanditParameter(Parameter[B]):
  def __init__(self, name: str,
    subparameters: Sequence[Parameter[A]],  # should be isomorphic to B, ignoring constraints on Parameter[A] domains
    domain: Sequence[B]
  ):
  ...

Effectively to enforce the membership of the elements in the Bandit domain in their respective Parameter[A] domains. The type signature above doesn't nail it exactly, but that's the motivation :)

Also for determining which encodings to use for parameters automatically in constructing models that support different types of parameters e.g. model A can handle categorical inputs natively, model B requires a 1-hot encoding.

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