-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor/distribution #22
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
base: main
Are you sure you want to change the base?
Conversation
|
Desiment
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add docstrings please
Also, about constraints - I missed how our discussion about distribution type and constrains resolved. From what I see nothing changed
| if np.any(vals <= 0.0): | ||
| return float("-inf") | ||
| return float(np.sum(np.log(vals))) | ||
| def log_likelihood(self, batch: Sample) -> float: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided to remove this method?
| s = 0.0 | ||
| for k in support.iter_leq(x): | ||
| s += float(pmf_func(float(k))) | ||
| return float(np.clip(s, 0.0, 1.0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For distributions with infinite support, this method will not work. For example, if X, Y ~ Poiss(1), are independent, then X - Y has infinite support (that is there infinite amount of points in support.iter_leq(x)).
| pass | ||
|
|
||
| # 3) Cursor-like API: first(), next(x) | ||
| if hasattr(support, "first") and hasattr(support, "next"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, "first" may not exists. As well as the "last".
X ~ Poiss(1) - last not exisits, support is N
Y ~ -Poiss(1) - first not exists, support is -N
X - Y support is Z
| ---------- | ||
| distribution : Distribution | ||
| **options : Any | ||
| Unused (kept for a uniform API with continuous fitters). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But API for continuous fitters has an option for "left/right" ppf
| Semantics | ||
| --------- | ||
| ``CDF(x) = sup { q ∈ [0,1] : PPF(q) ≤ x }`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this depends on the definition of PPF, and how it is computed (as left or right). Note that this does not matter in contiuous case (or, at least, should not)
Done:
Need to be done: