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

Expand parameter checks to include member set. #374

Open
Beakerboy opened this issue Mar 11, 2020 · 4 comments
Open

Expand parameter checks to include member set. #374

Beakerboy opened this issue Mar 11, 2020 · 4 comments

Comments

@Beakerboy
Copy link
Contributor

Since we have both discrete and continuous distributions, where parameters can be members of the integer set, natural numbers, or real numbers, it would be nice to be able to specify this the same way we specify parameter limits. I propose that we make the parameter definition an array, and the second element can be the member set. We could even have fun with it and use the standard characters of ℕ, ℝ, and ℤ.

@Beakerboy
Copy link
Contributor Author

In addition, would there be a simple enough way to define the limits of a support variable in terms of a parameter. In the Multivariate Hypergeometric distribution k ∈ [0,K]. I guess the constructor could create the ‘constant’.

@markrogoyski
Copy link
Owner

I like the idea. I'm not sure that we can't already do this though. Right now the limits check is a bounds check, high and low. If you have an int type declaration in your constructor and you define the bounds limit as (0,∞) then haven't you defined the set of natural numbers? int with no bounds is all integers. And float with no bounds is real numbers.

The use case I see that we cannot currently do is for some multivariate distribution like Hypergeometric where the constructor parameter is an array of an unspecified number of values. The PHP type system fails to help in this instance, although there are tricks you can do with the ... splat operator if you don't mind making your interface harder to deal with.

First steps: What is and isn't currently possible. What would we like to do. Then there is enough information to consider implementation options.

@Beakerboy
Copy link
Contributor Author

You’re right about type hints on the ‘standard’ distributions. This popped in my head when looking at the Multivariate Hypergeometric, where I had to put in a bunch of if (!is_int($value)) nonsense.

@markrogoyski
Copy link
Owner

All the multivariate distributions seem to take in an array of parameters. It'd be nice to have a standard self-documenting mechanism for validating these like the univariate ones. And whatever the solution is, it could probably be generalized so it works with the univariate distributions as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants