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

Implement lazy node label for easier datavars construction #155

Merged
merged 24 commits into from
Feb 27, 2024

Conversation

bvdmitri
Copy link
Member

This PR adds a possibility to create datavar automatically on demand without explicitly specifying their dimensions in advance. This is done by implementing LazyIndex which materializes node labels upon usage.

Additionally this PR implements a new syntax in the model specification with the new operator which will force create a new node label even if it wasn't defined before.

@bvdmitri bvdmitri requested review from wouterwln and removed request for wouterwln February 20, 2024 17:59
@bvdmitri
Copy link
Member Author

This PR also adds an error message for the following case

@model function simple_model_with_wrong_indexing()
    x ~ MvNormal([ 0.0, 0.0 ], [ 1.0 0.0; 0.0 1.0 ])
    y ~ Beta(x[1], x[2])
end
Indexing a single node label `x` with an index `[1]` is not allowed.

Copy link

codecov bot commented Feb 23, 2024

Codecov Report

Attention: Patch coverage is 86.11111% with 20 lines in your changes are missing coverage. Please review.

Project coverage is 91.06%. Comparing base (5028424) to head (3203330).
Report is 9 commits behind head on dev-4.0.0.

Files Patch % Lines
src/graph_engine.jl 85.83% 17 Missing ⚠️
src/model_macro.jl 86.95% 3 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           dev-4.0.0     #155      +/-   ##
=============================================
+ Coverage      90.50%   91.06%   +0.55%     
=============================================
  Files             14       14              
  Lines           1612     1724     +112     
=============================================
+ Hits            1459     1570     +111     
- Misses           153      154       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bvdmitri bvdmitri marked this pull request as ready for review February 27, 2024 08:25
@bvdmitri bvdmitri merged commit 3adbefd into dev-4.0.0 Feb 27, 2024
7 of 8 checks passed
@bvdmitri bvdmitri deleted the dev-4.0.0-lazy-nodelabel branch March 4, 2024 14:30
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