|
| 1 | +--- |
| 2 | +title: "DoodleBUGS: GSoC 2025 Report" |
| 3 | +description: "Goals, outcomes, and experience from GSoC 2025, with a high-level overview of DoodleBUGS and links to technical details." |
| 4 | +toc: true |
| 5 | +categories: |
| 6 | + - GSoC |
| 7 | + - Blog |
| 8 | +author: |
| 9 | + - name: Shravan Goswami |
| 10 | + url: https://shravangoswami.com/ |
| 11 | +date: 2025-08-30 |
| 12 | +aliases: |
| 13 | + - /news/posts/2025-08-30-DoodleBUGS-GSoC-2025-Report |
| 14 | + - /DoodleBUGS-GSoC-2025-Report |
| 15 | +bibliography: references.bib |
| 16 | +csl: university-of-york-ieee.csl |
| 17 | +link-citations: true |
| 18 | +nocite: | |
| 19 | + @* |
| 20 | +--- |
| 21 | + |
| 22 | +## TL;DR |
| 23 | + |
| 24 | +- BUGS is a domain-specific language for Bayesian models; JuliaBUGS is its modern Julia implementation. DoodleBUGS is a browser-based graphical interface for JuliaBUGS. |
| 25 | +- Outcomes: working visual editor, legacy BUGS export that compiles with JuliaBUGS, local execution via a Julia backend, unified standalone script generation, timeouts, multiple layouts (Dagre [default], fCoSE, Cola, Klay), and a cleaned-up, typed codebase. |
| 26 | +- For architecture, execution, and API details, see the companion technical post: [DoodleBUGS: Introduction](/DoodleBUGS-Introduction/). |
| 27 | +- Try it here (static UI): [https://turinglang.org/JuliaBUGS.jl/DoodleBUGS/](https://turinglang.org/JuliaBUGS.jl/DoodleBUGS/) |
| 28 | +- Default timeout is 0 (disabled); configurable in Execution Settings. |
| 29 | + |
| 30 | +## Motivation |
| 31 | + |
| 32 | +[JuliaBUGS](https://github.com/TuringLang/JuliaBUGS.jl) is a modern Julia implementation of the BUGS language [@bugs-rjournal; @bugs-book; @bugs-project]. DoodleBUGS revives the original visual modeling concept with a modern browser-based stack so users can: |
| 33 | + |
| 34 | +- Construct probabilistic graphical models visually (nodes, edges, plates). |
| 35 | +- Export readable legacy BUGS code that compiles with JuliaBUGS [@JuliaBUGS; @bugs-rjournal; @bugs-book]. |
| 36 | +- Run inference and inspect results from the UI. Common BUGS applications include parallel MCMC [@multibugs], survival analysis [@bugs-survival], and Gibbs-style samplers [@albert-chib-1993; @informs-gibbs]. |
| 37 | + |
| 38 | +## What Was Built |
| 39 | + |
| 40 | +- Visual editor |
| 41 | + - Node types: stochastic, observed, deterministic |
| 42 | + - Plates with arbitrary nesting; robust drag-in/out and creation inside plates |
| 43 | + - Graph layouts: |
| 44 | + - Dagre (Hierarchical) [default] |
| 45 | + - fCoSE (Force-Directed) |
| 46 | + - Cola (Physics Simulation) |
| 47 | + - Klay (Layered) |
| 48 | +- Legacy BUGS code generation [@bugs-rjournal; @bugs-book] |
| 49 | + - Topological ordering and plate-aware traversal |
| 50 | + - Parameter formatting and safe index expansion |
| 51 | +- Execution flow (high-level) |
| 52 | + - Frontend generates legacy BUGS `model_code` plus `data`, `inits`, `settings` and can generate a standalone Julia script. |
| 53 | + - When connected, it sends a JSON payload to the Julia backend at `/api/run` (alias: `/api/run_model`). |
| 54 | + - Backend compiles via `JuliaBUGS.@bugs` and runs sampling with `AdvancedHMC.NUTS` through `AbstractMCMC`; returns summaries/quantiles as JSON. |
| 55 | +- Resilience and ergonomics |
| 56 | + - Configurable timeouts (default 0 = disabled); safe temp cleanup on Windows |
| 57 | + - Unified standalone script generation lives in the frontend |
| 58 | + |
| 59 | +## Why Vue (not React)? |
| 60 | + |
| 61 | +The proposal planned React; we chose Vue 3 after evaluating the graph layer and developer velocity for this app. |
| 62 | + |
| 63 | +- Konva (canvas) required bespoke graph semantics (hit testing, edge routing, compound nodes) that [Cytoscape.js](https://js.cytoscape.org/) already provides. |
| 64 | +- D3 layouts are flexible, but compound nodes (plates), nesting, and drag constraints became significant custom work. |
| 65 | +- [Cytoscape.js](https://js.cytoscape.org/) offered native compound nodes (great for plates), integrated layouts (Dagre [default], fCoSE, Cola, Klay), and mature performance [@webcola; @elk]. |
| 66 | +- [Vue 3](https://vuejs.org/) with the Composition API made integrating Cytoscape straightforward via composables and lifecycle hooks; Pinia stores + SFC ergonomics improved iteration speed. |
| 67 | + |
| 68 | +## Comparison to Legacy DoodleBUGS |
| 69 | + |
| 70 | +The legacy tool was a desktop application driving WinBUGS [@winbugs]; the new DoodleBUGS is a browser-based editor targeting JuliaBUGS [@JuliaBUGS]. Key differences: |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +- Platform and backend |
| 77 | + - Legacy: Desktop UI, WinBUGS execution pipeline |
| 78 | + - New: Web UI, Julia backend via `JuliaBUGS.@bugs`, sampling with `AdvancedHMC.NUTS` through `AbstractMCMC` |
| 79 | +- Graph engine and plates |
| 80 | + - Legacy: Bespoke graph handling with limited nesting semantics |
| 81 | + - New: [Cytoscape.js](https://js.cytoscape.org/) with compound nodes for robust nested plates; custom Drag and Drop for drag-in/out and creating inside plates. Overlapped plates (multiple parents) are not supported; tracked here: [https://github.com/TuringLang/JuliaBUGS.jl/issues/362](https://github.com/TuringLang/JuliaBUGS.jl/issues/362) |
| 82 | +- Layouts and interactions |
| 83 | + - Legacy: Limited auto-layout support |
| 84 | + - New: Multiple layout engines and stable interactions: |
| 85 | + - Dagre (Hierarchical) [default] |
| 86 | + - fCoSE (Force-Directed) |
| 87 | + - Cola (Physics Simulation) |
| 88 | + - Klay (Layered) |
| 89 | +- Code generation |
| 90 | + - Legacy: Export to BUGS without strong ordering guarantees |
| 91 | + - New: Deterministic topological + plate-aware traversal; parameter canonicalization and safe index expansion |
| 92 | +- DevX and maintainability |
| 93 | + - New: Vue 3 + TypeScript + Pinia; unified standalone script generation on the frontend; leaner backend responses |
| 94 | + |
| 95 | +## Progress vs Proposal |
| 96 | + |
| 97 | +- Implemented |
| 98 | + - Visual editor with nested plates and robust Drag and Drop |
| 99 | + - BUGS code generator (topological + plate-aware) |
| 100 | + - Local execution + summaries/quantiles (summary includes mean, std, mcse, ess_bulk, ess_tail, rhat, etc.) |
| 101 | + - Unified standalone script generation (frontend) |
| 102 | + - Timeouts/resilience |
| 103 | + - Multiple layouts and interactions (Dagre [default], fCoSE, Cola, Klay) |
| 104 | + - Extensive cleanup/typing |
| 105 | +- Changed |
| 106 | + - Vue 3 instead of React |
| 107 | + - Backend responses smaller; no standalone script attachment |
| 108 | +- Deferred/Partial |
| 109 | + - Rich visualization (PPC, trace/density plots). R-hat and ESS are already included in the summary statistics. |
| 110 | + - WebKit/Safari support |
| 111 | + - UX polish for large graphs |
| 112 | + |
| 113 | +## Cross-links |
| 114 | + |
| 115 | +- For architecture, execution, API, and how-to-run details, see the companion technical post: [DoodleBUGS: Introduction](/DoodleBUGS-Introduction/). |
| 116 | + |
| 117 | +## Acknowledgements |
| 118 | + |
| 119 | +Much appreciation goes to my mentors Xianda Sun and Hong Ge. The work is impossible without your help and support. |
| 120 | + |
| 121 | +- Mentors: Xianda Sun ([\@sunxd3](https://github.com/sunxd3)) and Hong Ge ([\@yebai](https://github.com/yebai)) |
| 122 | +- TuringLang/JuliaBUGS community and contributors |
| 123 | + |
| 124 | +## Appendix: Links |
| 125 | + |
| 126 | +- Repo: [https://github.com/TuringLang/JuliaBUGS.jl](https://github.com/TuringLang/JuliaBUGS.jl) |
| 127 | +- Try it here (static UI): [https://turinglang.org/JuliaBUGS.jl/DoodleBUGS/](https://turinglang.org/JuliaBUGS.jl/DoodleBUGS/) |
0 commit comments