Skip to content

Add Gamma distribution implementation and corresponding tests - #181

Merged
marcelluethi merged 1 commit into
dimwit-dev:mainfrom
marcelluethi:gamma-distribution
Nov 3, 2026
Merged

marcelluethi merged 1 commit into
dimwit-dev:mainfrom
marcelluethi:gamma-distribution

Conversation

@marcelluethi

Copy link
Copy Markdown
Contributor

No description provided.

@benikm91 benikm91 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the scale comment. But looks good

*/
class Gamma[T <: Tuple: Labels, V: IsFloating](val concentration: Tensor[T, V], val rate: Tensor[T, V]) extends IndependentDistribution[T, V]:

private lazy val scale = Tensor.like(rate).fill(1f) / rate

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we think about the trade offs of having this as a private field? Memory vs. Performance

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. But I think it is a good trade-off here. And if it turns out to be the wrong trade-off, we can easily change it afterwards without breaking the interface.

@marcelluethi
marcelluethi merged commit 1efe225 into dimwit-dev:main Nov 3, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants