{"id":46300168,"url":"https://github.com/hal-lab-u-tokyo/openbnsl","last_synced_at":"2026-03-04T11:01:31.220Z","repository":{"id":275551138,"uuid":"890779509","full_name":"hal-lab-u-tokyo/OpenBNSL","owner":"hal-lab-u-tokyo","description":"OpenBNSL is a unified, open-source, and comprehensive framework for evaluating Bayesian Network Structure Learning (BNSL) methods","archived":false,"fork":false,"pushed_at":"2025-11-20T07:44:31.000Z","size":2658,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-20T08:16:43.222Z","etag":null,"topics":["bayesian-networks","machine-learning"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hal-lab-u-tokyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-19T06:58:10.000Z","updated_at":"2025-11-17T01:29:41.000Z","dependencies_parsed_at":"2025-02-03T09:26:47.718Z","dependency_job_id":"796615cc-7047-4ccc-8693-be79dbf7b397","html_url":"https://github.com/hal-lab-u-tokyo/OpenBNSL","commit_stats":null,"previous_names":["hal-lab-u-tokyo/openbnsl"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/hal-lab-u-tokyo/OpenBNSL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-lab-u-tokyo%2FOpenBNSL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-lab-u-tokyo%2FOpenBNSL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-lab-u-tokyo%2FOpenBNSL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-lab-u-tokyo%2FOpenBNSL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hal-lab-u-tokyo","download_url":"https://codeload.github.com/hal-lab-u-tokyo/OpenBNSL/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hal-lab-u-tokyo%2FOpenBNSL/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30078406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T08:01:56.766Z","status":"ssl_error","status_checked_at":"2026-03-04T08:00:42.919Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bayesian-networks","machine-learning"],"created_at":"2026-03-04T11:01:30.132Z","updated_at":"2026-03-04T11:01:31.201Z","avatar_url":"https://github.com/hal-lab-u-tokyo.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenBNSL\r\n\r\nOpenBNSL is a unified framework for fair, reproducible, and transparent comparison of Bayesian Network Structure Learning (BNSL) algorithms.\r\n\r\n**Note:**  \r\n\u003e OpenBNSL supports **categorical (discrete)** variables only.  \r\n\r\n| Component                  | Description                                               |\r\n|----------------------------|-----------------------------------------------------------|\r\n| **Core Library**           | BNSL algorithms in C/C++ with OpenMP and CUDA             |\r\n| **Evaluation Suite**       | Evaluation modules and Benchmark scripts in Python        |\r\n| **Experiment Environment** | Docker-based environment for reproducible experiments     |\r\n\r\n![OpenBNSL Architecture](images/architecture.png)\r\n\r\n1. [Setup](#setup)\r\n2. [Build and Install](#build-and-install)\r\n3. [Features](#features)\r\n4. [Contributing](#contributing)\r\n5. [License](#license)\r\n6. [Acknowledgments](#acknowledgments)\r\n\r\n---\r\n# Setup\r\n\r\nWe **strongly recommend** using the Docker environment. \r\n\r\n```bash\r\ngit clone --recurse-submodules git@github.com:hal-lab-u-tokyo/OpenBNSL.git # for pybind11 submodule\r\ncd OpenBNSL\r\n\r\ndocker compose build \\\r\n  [--build-arg BASE_IMAGE=nvidia/cuda:13.0.2-devel-ubuntu24.04] \\  # optional: Nvidia GPU support\r\n\r\ndocker compose up\r\n```\r\n\r\n\u003c!-- For Future Use (R, bnlearn, Gurobi) --\u003e\r\n\u003c!-- \r\n```bash\r\ngit clone --recurse-submodules git@github.com:hal-lab-u-tokyo/OpenBNSL.git # for pybind11 submodule\r\ncd OpenBNSL\r\ndocker compose build \\\r\n  [--build-arg BASE_IMAGE=nvidia/cuda:12.6.2-devel-ubuntu22.04] \\  # optional: Nvidia GPU support\r\n  [--build-arg INSTALL_R=true] \\                                   # R \u0026 bnlearn\r\n  [--build-arg INSTALL_GUROBI=true]                                # Gurobi (requires license)\r\ndocker compose up\r\n``` \r\n--\u003e\r\n\r\n---\r\n# Build and Install\r\n\r\n```bash\r\n# Inside the Docker container\r\nuv pip install . # builds the C++ core + installs Python bindings\r\nOPENBNSL_DEBUG=ON uv pip install . # enable debug logs\r\n```\r\n\r\n# Example Notebooks\r\nSee the examples in the [examples](examples/) directory:\r\n\r\n# Benchmarks\r\nSee the benchmarks in the [benchmarks/](benchmarks/) directory.\r\n\r\nIllustrative example [`benchmarks/scenarios/benchmark_pc.py`](benchmarks/scenarios/benchmark_pc.py):\r\n```bash\r\n# Run example benchmark (PC vs. pgmpy-PC)\r\nroot@container:/workspace# pytest -s benchmarks/scenarios/benchmark_pc.py\r\n\r\n=================================================================== test session starts ===================================================================\r\nplatform linux -- Python 3.10.12, pytest-8.3.3\r\ncollected 40 items\r\n\r\n[...]\r\n\r\n--- Summary for benchmark_pc ---\r\nmodel_name  num_vars  num_samples citest             algo  num_threads  count  shd_mean  shd_std  original_score_mean  learned_score_mean  score_ratio_mean  time_mean_s  time_std_s\r\n     alarm        37       200000   chi2 pc_edge_parallel          128      5      3.80     4.02          -2089569.51         -1995558.15              0.96         1.13        0.07\r\n     alarm        37       200000   chi2         pc_pgmpy          128      5      4.40     3.13          -2089569.51         -1993880.95              0.95        67.52        2.22\r\n     child        20       200000   chi2 pc_edge_parallel          128      5      0.40     0.89          -2441167.36         -2136790.53              0.88         1.43        0.07\r\n     child        20       200000   chi2         pc_pgmpy          128      5      0.00     0.00          -2441167.36         -2136840.17              0.88        63.23        3.81\r\n insurance        27       200000   chi2 pc_edge_parallel          128      5     17.40     5.68          -2616514.00         -2624224.05              1.00         3.30        0.14\r\n insurance        27       200000   chi2         pc_pgmpy          128      5     26.80     3.83          -2616514.00         -2681482.42              1.02       166.16        6.67\r\n     water        32       200000   chi2 pc_edge_parallel          128      5     34.80     1.48          -2557434.16         -2407465.94              0.94         1.18        0.04\r\n     water        32       200000   chi2         pc_pgmpy          128      5     43.20     3.27          -2557434.16         -2410543.49              0.94        57.58        2.03\r\n\r\n\r\n===================================================================================================================================== 40 passed in 1915.17s (0:31:55) ======================================================================================================================================\r\n```\r\n\r\n\r\n\r\n---\r\n# Key Features\r\n- Core Library (C/C++ with OpenMP \u0026 optional CUDA)\r\n    - Score-based Structure Learning\r\n        - [x] Dynamic Programming on subset lattice\r\n        - [x] Simulated Annealing on Parent-Set Space \r\n    - Constraint-based Structure Learning\r\n        - [x] Peter-Clark (PC) with edge-parallel CI tests \r\n        - [x] Recursive Autonomy Identification (RAI) with edge-parallel CI tests\r\n        - [ ] Peter-Clark (PC) using GPU\r\n    - local-to-global learning\r\n        - [ ] \r\n- Evaluation Suite (Python)\r\n    - Evaluation Metrics\r\n        - [x] Structural Hamming Distance (SHD)\r\n        - [x] Marginal Likelihood (ML)\r\n        - [ ] Inference accuracy\r\n    - Benchmarking Scenarios\r\n        - [x] PC vs. RAI  [`benchmarks/scenarios/benchmark_pc_and_rai.py`](benchmarks/scenarios/benchmark_pc_and_rai.py)\r\n        - [x] OpenBNSL PC vs. pgmpy PC  [`benchmarks/scenarios/benchmark_pc.py`](benchmarks/scenarios/benchmark_pc.py)\r\n    - Examples\r\n        - [x] Run PC Algorithm and Visualize the Learned Structure [`examples/run_pc.ipynb`](examples/run_pc.ipynb)\r\n        - [ ] scalability for number of samples\r\n- Experiment Environment (Docker)\r\n    - [x] OpenMP support (default)\r\n    - [x] Nvidia GPU and CUDA toolkit support\r\n    - [ ] Gurobi support\r\n    - [ ] R and `bnlearn` support\r\n\r\n--- \r\n# Documentation\r\nMore details can be found in the [https://hal.ipc.i.u-tokyo.ac.jp/OpenBNSL/](https://hal.ipc.i.u-tokyo.ac.jp/OpenBNSL/)\r\n\r\n--- \r\n# Contributing\r\nWe welcome issues and pull requests!\r\nPlease see the guidelines in [CONTRIBUTING](CONTRIBUTING.md) for more details.\r\n\r\n--- \r\n# License\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n\u003c!-- \r\n---\r\n# References\r\nIf you use OpenBNSL in your research, please cite the following paper:\r\n\r\n```bibtex\r\n\r\n``` \r\n--\u003e\r\n\r\n---\r\n# Acknowledgments\r\nThis work was supported by \r\nJSPS KAKENHI JP24KJ0578, \r\nJST CREST JPMJCR21D2, and \r\nJST SPRING JPMJSP2108, \r\nJapan.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhal-lab-u-tokyo%2Fopenbnsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhal-lab-u-tokyo%2Fopenbnsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhal-lab-u-tokyo%2Fopenbnsl/lists"}