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

@constraints simply ignore incomplete factorization constraints without any warning #118

Closed
bvdmitri opened this issue May 24, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@bvdmitri
Copy link
Member

bvdmitri commented May 24, 2023

The following code ignores the factorization constraints and does not give any warning

@constraints begin
    q(x)q(y)
    # should be q(x, y) = q(x)q(y) but no error or warning is shown
end

Found by @ThijsvdLaar

@bvdmitri bvdmitri self-assigned this May 24, 2023
@albertpod albertpod added the bug Something isn't working label Jun 1, 2023
@albertpod albertpod added this to RxInfer Jun 1, 2023
@albertpod albertpod moved this to 👉 Assigned in RxInfer Jun 1, 2023
@bvdmitri
Copy link
Member Author

bvdmitri commented Oct 5, 2023

ping @wouterwln , check that this bug is not present in the new version

@bvdmitri bvdmitri moved this from 👉 Assigned to 📝 In progress in RxInfer Oct 5, 2023
@wouterwln
Copy link
Member

@bvdmitri this throws an UndefVarError on q, is that enough?

@bvdmitri
Copy link
Member Author

bvdmitri commented Oct 5, 2023

We can throw a user-friendly error or something when we encounter smth which is unexpected (basically when not a single @capture captured the problematic expression)?

@wouterwln
Copy link
Member

Coming back to this, I don't know if we can safely check if something is not captured by a single pipeline, since we do a postwalk over expressions and not over lines. A lot of expressions will not be captured by any pipeline. Any suggestions?

@bvdmitri
Copy link
Member Author

bvdmitri commented Oct 24, 2023

I think the issue here is that q(x)q(y) is being transformed even though it first must a part of the lhs_ = rhs_ expression and only then it can be transformed. q(x)q(y) by itself should not be transformed and should be just a function call to q, or at least we could throw an error if q(x)q(y) expression is being captured outside of the lhs_ = rhs_.

@wouterwln
Copy link
Member

That is exactly what happens, I could design an additional pipeline that triggers when it encounters a call to q that is not wrapped in a lhs_ = rhs_ or lhs_ :: rhs_ statement, but that seems a bit unsafe to me, don't you think?

@bvdmitri
Copy link
Member Author

Yeah, it is unsafe, because there can a be a function named q(). So, technically a raw statement q(x)q(y) is not wrong, given that there is a global q function, the thing is that it works even if there is no global q function, which should simply throw q is not defined error IMO.

I think you already know by yourself that less transformation we do in macros is better ;)

@wouterwln
Copy link
Member

This is fixed in ReactiveBayes/GraphPPL.jl#117. I throw an ErrorException for now. We can design a custom warning/error ad hoc

@github-project-automation github-project-automation bot moved this from 📝 In progress to ✅ Done in RxInfer Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants