• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TuringLang / JuliaBUGS.jl / 8308493870
82%
main: 84%

Build:
Build:
LAST BUILD BRANCH: sg/#380
DEFAULT BRANCH: main
Ran 16 Mar 2024 02:49PM UTC
Jobs 1
Files 43
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

16 Mar 2024 02:40PM UTC coverage: 81.275% (-0.3%) from 81.55%
8308493870

push

github

web-flow
Refactor graph creation and node function handling (#163)

This PR introduces several enhancements and refactors the graph creation
process and node function handling in JuliaBUGS. The main changes
include:

* Sharing node function expressions across nodes:

Previously, each node in the graph had its own unique node function
expression. This PR modifies the behavior so that nodes originating from
the same statement in the model definition share the same node function
expression.

  Example:
  ```julia
  @bugs begin
      for i in 1:2
          x[i] ~ dnorm(0, 1)
          y[i] ~ dnorm(x[i], i)
      end
  end
  ````
In the previous version, the nodes for x[1], x[2], y[1], and y[2] would
have separate node function expressions. Now, they will share the
expressions dnorm(0, 1) and dnorm(x[i], i) based on the corresponding
statements.

The function `replace_constants_in_expr` used to plugin all the scalar
values into the node function expr, now the function is removed. The new
node function is a function takes all the variable on the RHS as
arguments (including loop variables).
  E.g., 
  ```julia
  function (;x::AbstractArray{Float64}, i::Int)
      return dnorm(x[1], i)
  end
  ```
The binding of loop variables to values are stored at nodes, and used
when evaluating node function.

This change reduces memory usage and paves the way for potentially
evaluating node functions once and using compiled functions during model
evaluation.

* Simplifying the graph creation process:
  The graph building algorithm has been overhauled for clarity.

  Example:
  ```julia
  @bugs begin
      x[1:2] ~ dmnorm(...)
      x[3] ~ dnorm(0, 1)
      y ~ dnorm(sum(x[2:3]), 1)
  end
  ```
In the previous version, temporary nodes were created for variables used
on the RHS that were not explicitly defined in the model, such as `x[1],
x[2], x[2:3]`. These temporary nodes needed to be removed later, adding
complexity to the... (continued)

247 of 261 new or added lines in 5 files covered. (94.64%)

4 existing lines in 3 files now uncovered.

1441 of 1773 relevant lines covered (81.27%)

227972.52 hits per line

Jobs
ID Job ID Ran Files Coverage
1 8308493870.1 16 Mar 2024 02:49PM UTC 0
81.27
GitHub Action Run
Source Files on build 8308493870
Detailed source file information is not available for this build.
  • Back to Repo
  • dddc106f on github
  • Prev Build on master (#8299530212)
  • Next Build on master (#8328653629)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc