{"id":20751280,"url":"https://github.com/cbg-ethz/sgs","last_synced_at":"2025-04-28T13:12:21.783Z","repository":{"id":40268294,"uuid":"438650155","full_name":"cbg-ethz/SGS","owner":"cbg-ethz","description":"Inference in Bayesian Networks with R","archived":false,"fork":false,"pushed_at":"2023-02-06T17:07:30.000Z","size":5462,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-28T13:12:14.149Z","etag":null,"topics":["bayesian-network","bayesian-networks","graphical-models","inference","missing-data","probabilistic-graphical-models"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2112.09217","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cbg-ethz.png","metadata":{"files":{"readme":"ReadMe.md","changelog":"NEWS.md","contributing":null,"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}},"created_at":"2021-12-15T14:01:06.000Z","updated_at":"2024-11-12T08:00:24.000Z","dependencies_parsed_at":"2024-11-17T23:17:58.062Z","dependency_job_id":null,"html_url":"https://github.com/cbg-ethz/SGS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbg-ethz%2FSGS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbg-ethz%2FSGS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbg-ethz%2FSGS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbg-ethz%2FSGS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cbg-ethz","download_url":"https://codeload.github.com/cbg-ethz/SGS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251319594,"owners_count":21570428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-network","bayesian-networks","graphical-models","inference","missing-data","probabilistic-graphical-models"],"created_at":"2024-11-17T08:32:28.576Z","updated_at":"2025-04-28T13:12:21.474Z","avatar_url":"https://github.com/cbg-ethz.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv \u003e \n  \u003cimg src=\"vignettes/sgs_icon.png\" width=\"35%\" height=\"35%\"\u003e\n\u003c/div\u003e\n\nInference in Bayesian Networks\n-----------\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n`SGS` is an R package for inference in Bayesian networks. It allows for efficient exact and approximate inference that works both in low- and high-dimensional settings. Efficient marginalization is reached by splitting the calculation into sub-calculations of lower dimensionality. \nThis code is an implementation of the paper [High-Dimensional Inference in Bayesian Networks](https://arxiv.org/abs/2112.09217), [arXiv preprint](https://arxiv.org/abs/2112.09217).\n\nImplemented exact inference methods:\n- SubGroupSeparation (fastest)\n- Junction-tree algorithm\n- Complete enumeration\n\nImplemented approximate inference methods:\n- SubGroupSeparation (highest accuracy)\n- Loopy belief propagation\n- Markov chain Monte Carlo (MCMC) sampling\n\n\nInstallation\n-----------\n\nIn order to install the package, it suffices to launch\n`R CMD INSTALL path/to/SGS`\nfrom a terminal, or `make install` from within the package source folder.\n\nBeing hosted on GitHub, it is possible to use the `install_github`\ntool from an R session:\n\n```\nif (!requireNamespace(\"BiocManager\", quietly = TRUE)) install.packages(\"BiocManager\")\nBiocManager::install(c(\"graph\", \"Rgraphviz\", \"RBGL\"))\n\nlibrary(\"devtools\")\ninstall_github(\"cbg-ethz/SGS\")\n```\n\nThe packages \"graph\", \"Rgraphviz\" and \"RBGL\" need to be installed from BioConductor, as they are not hosted on CRAN.\n\n`SGS` requires R `\u003e= 3.5`, and depends on\n`bitops` and\n`methods`. Other packages are requested in\norder to plot graphs, but are not mandatory.\n\n\nExamples\n-------\n\n```\nlibrary(SGS)\n\n# create BN and label variables \nset.seed(6)\nmyBayesNet \u003c- randomBN(3)\nmyBayesNet@variables \u003c- c(\"rain\", \"sprinkler\", \"wet grass\")\nplot_bn(myBayesNet)\n\n# what's the probability of having rain and wet grass at the same time?\n# define observed variables and calculate marginal probability\nmyObserved \u003c- list(observed.vars=c(\"rain\", \"wet grass\"), observed.vals=c(2,2))\nexactInference(myBayesNet,myObserved)\n\n# another example: \n# let's learn the Bayesian network from the \"Asia dataset\"\nasia_bn \u003c- learn_bn(Asia)\nplot_bn(asia_bn)\n\n# now we can do the inference on the learned Bayesian network\nmyObserved \u003c- list(observed.vars=c(\"X\", \"D\"), observed.vals=c(1,1))\nexactInference(asia_bn, myObserved)\n```\n\nBenchmark Results \n-------\n\nWe benchmarked the performance of our SGS method against standard inference schemes (Gibbs sampling and loopy belief propagation) over a broad range of different Bayesian networks. The results are summarized in the Figure below (lower is better), displaying the normalized root mean squared error (NRMSE). To reproduce the results, run the scripts in the benchmark folder. \n\n# ![SGS](https://github.com/cbg-ethz/SGS/blob/master/vignettes/benchmark.png)\n\nReference\n---------\n\nIf you find this code useful, please consider citing:\n\nFritz M. Bayer, Giusi Moffa, Niko Beerenwinkel, Jack Kuipers. [High-Dimensional Inference in Bayesian Networks](https://arxiv.org/abs/2112.09217), [arXiv preprint](https://arxiv.org/abs/2112.09217), 2021\n\n```\n@article{bayer2021marginalization,\n  title={High-Dimensional Inference in Bayesian Networks},\n  author={Bayer, Fritz M and Moffa, Giusi and Beerenwinkel, Niko and Kuipers, Jack},\n  journal={arXiv preprint arXiv:2112.09217},\n  year={2021}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbg-ethz%2Fsgs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcbg-ethz%2Fsgs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbg-ethz%2Fsgs/lists"}