Skip to content

Conversation

@ofSingularMind
Copy link

Addresses Issue #76

end

try
projection_argument.logpdf!([0.0], randn(prj.dims))
Copy link
Member

Choose a reason for hiding this comment

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

I guess I understand what you actually want to do. You want to take a sample from a representative of a distribution class and check if the logpdf! actually supports these samples. But why does it need to be implemented here, first? And second, it would simply never work - prj.dims does not support sampling.

Copy link
Member

Choose a reason for hiding this comment

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

I don’t think it’s very clean code to intentionally trigger an error. Instead, I’d suggest extending the projection_argument interface — for example, by introducing a method such as:

ExponentialFamilyProjection.check_dimensionality_compatibility(projection_argument, prj.dims)

This method could be optionally implemented by the user before applying the projection. By default, it might do nothing, but if the user wants dimensionality checks, they can override it. The documentation could encourage implementing this method when appropriate.

Copy link
Member

Choose a reason for hiding this comment

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

I like this idea. I think maybe instead of just check_dimensionality_compatibility, we could check compatibility with the manifold argument—it's richer and allows us to do all sorts of checks

Copy link
Member

@Nimrais Nimrais Nov 4, 2025

Choose a reason for hiding this comment

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

For example, it can implement the check that @ofSingularMind wants. You can sample a random distribution d from M and sample a random sample from this d and do the check with logpdf! call.

Copy link
Author

Choose a reason for hiding this comment

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

prj.dims is just a number, and randn(d) is just a vector. I'm not intending to sample anything - just insert the suggested size vector as input into the logpdf!() call to ensure these dimensions are supported. Can use zeros(prj.dims) etc.

For sure you guys can find a better way. I just feel like if adding this simple check erases three issues/discussions from popping up from users, maybe it is worth it. Anyways, my code works now ;)

Copy link
Author

Choose a reason for hiding this comment

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

@copilot review this discussion and the suggested change, and the associated package / file and suggest a clean, simple, stable check

Copy link

Copilot AI commented Nov 4, 2025

@ofSingularMind I've opened a new pull request, #78, to work on those changes. Once the pull request is ready, I'll request review from you.

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.

4 participants