{"id":20383869,"url":"https://github.com/emansarahafi/uncertainty-lab","last_synced_at":"2026-05-28T01:31:55.484Z","repository":{"id":230972066,"uuid":"780616046","full_name":"emansarahafi/Uncertainty-Lab","owner":"emansarahafi","description":"A demonstration of Bayesian Networks and probabilistic reasoning using the classic burglar alarm problem.","archived":false,"fork":false,"pushed_at":"2025-12-05T21:35:17.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-29T14:32:56.883Z","etag":null,"topics":["conditional-probability","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/emansarahafi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-04-01T20:54:21.000Z","updated_at":"2025-12-05T21:35:48.000Z","dependencies_parsed_at":"2024-04-01T22:23:12.459Z","dependency_job_id":"cb050fa6-eceb-4f0e-a77b-be92440b7744","html_url":"https://github.com/emansarahafi/Uncertainty-Lab","commit_stats":null,"previous_names":["emansarahafi/uncertainty-lab"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/emansarahafi/Uncertainty-Lab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emansarahafi%2FUncertainty-Lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emansarahafi%2FUncertainty-Lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emansarahafi%2FUncertainty-Lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emansarahafi%2FUncertainty-Lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emansarahafi","download_url":"https://codeload.github.com/emansarahafi/Uncertainty-Lab/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emansarahafi%2FUncertainty-Lab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33590884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["conditional-probability","python"],"created_at":"2024-11-15T02:24:51.369Z","updated_at":"2026-05-28T01:31:55.478Z","avatar_url":"https://github.com/emansarahafi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Uncertainty Lab\n\nAn Artificial Intelligence (CS485) lab demonstrating Bayesian Networks and probabilistic reasoning using the classic burglar alarm problem.\n\n## Overview\n\nThis project implements a Bayesian Network to model uncertainty and conditional dependencies in a real-world scenario. The network models the relationships between burglaries, earthquakes, alarm systems, and witnesses (John and Mary) who might call about the alarm.\n\n## Problem Description\n\nThe burglar alarm problem is a classic example in probabilistic reasoning:\n\n- A house has a burglar alarm that can be triggered by either a **burglary** or an **earthquake**\n- Two neighbors, **John** and **Mary**, might call if they hear the alarm\n- Each event has associated probabilities and conditional dependencies\n\nThe Bayesian Network captures these relationships:\n\n```\nBurglar ──┐\n          ├─→ Alarm ──┬─→ John\nEarthquake┘           └─→ Mary\n```\n\n## Files\n\n- `model.py`: Defines the Bayesian Network structure with nodes and conditional probability tables\n- `inference.py`: Performs probabilistic inference given observed evidence (John and Mary both called)\n\n## Requirements\n\n```bash\npip install pomegranate\n```\n\n## Usage\n\nRun the inference script to calculate probabilities:\n\n```bash\npython inference.py\n```\n\n### Example Output\n\nGiven that both John and Mary called (evidence), the model computes the posterior probabilities for each variable:\n\n```\nburglar: Probability distribution over {yes, no}\nearthquake: Probability distribution over {yes, no}\nalarm: Probability distribution over {yes, no}\njohn: yes (observed)\nmary: yes (observed)\n```\n\n## Model Details\n\n### Prior Probabilities\n\n- Burglary: 0.001 (0.1%)\n- Earthquake: 0.002 (0.2%)\n\n### Conditional Probabilities\n\n- **Alarm** depends on Burglar and Earthquake\n  - P(Alarm=yes | Burglar=yes, Earthquake=yes) = 0.95\n  - P(Alarm=yes | Burglar=yes, Earthquake=no) = 0.94\n  - P(Alarm=yes | Burglar=no, Earthquake=yes) = 0.29\n  - P(Alarm=yes | Burglar=no, Earthquake=no) = 0.001\n\n- **John calls** depends on Alarm\n  - P(John=yes | Alarm=yes) = 0.9\n  - P(John=yes | Alarm=no) = 0.05\n\n- **Mary calls** depends on Alarm\n  - P(Mary=yes | Alarm=yes) = 0.7\n  - P(Mary=yes | Alarm=no) = 0.01\n\n## Learning Outcomes\n\nThis lab demonstrates:\n\n- Bayesian Network construction and representation\n- Conditional probability tables (CPTs)\n- Probabilistic inference using evidence\n- Reasoning under uncertainty\n- The pomegranate library for probabilistic modeling\n\n## License\n\nSee [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femansarahafi%2Funcertainty-lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femansarahafi%2Funcertainty-lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femansarahafi%2Funcertainty-lab/lists"}