{"id":30961663,"url":"https://github.com/magier/halga","last_synced_at":"2025-09-11T18:31:08.159Z","repository":{"id":219253159,"uuid":"360507013","full_name":"Magier/HalGA","owner":"Magier","description":"An educational tool showing how an evolutionary algorithm can be use to learn the structure of Bayesian network","archived":false,"fork":false,"pushed_at":"2021-04-23T19:04:48.000Z","size":89,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-01-26T11:45:48.264Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Magier.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2021-04-22T12:13:42.000Z","updated_at":"2024-01-26T11:45:53.275Z","dependencies_parsed_at":"2024-01-26T11:45:51.802Z","dependency_job_id":"a14b700d-de4c-47a0-8470-194a6b05d508","html_url":"https://github.com/Magier/HalGA","commit_stats":null,"previous_names":["magier/halga"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Magier/HalGA","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magier%2FHalGA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magier%2FHalGA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magier%2FHalGA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magier%2FHalGA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Magier","download_url":"https://codeload.github.com/Magier/HalGA/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magier%2FHalGA/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274684363,"owners_count":25330764,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"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":[],"created_at":"2025-09-11T18:31:05.155Z","updated_at":"2025-09-11T18:31:07.995Z","avatar_url":"https://github.com/Magier.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HalGA\nAn educational tool showing how an evolutionary algorithm can be use to learn the structure of a Bayesian network.\n\nThe approach is heavily inspired by the example provided in the documentation of [Halerium](https://hal.erium.io/examples/04_causal_structure/03-causal_structure_calschool.html), where the causal structure is defined for the [California School](https://rdrr.io/cran/Ecdat/man/Caschool.html) data set.\n\n### Core Idea:\nLearn a Bayesian Network purely from observational data. The resulting model should do well on predicting `mathscr`, `readscr` and `testscr`.  \nThis task can be broken down into the subtasks of:\n- **learning the causal structure** → use a **Genetic Algorithm**\n- learning the parameters → train Bayesian Network on data using Halerium for proposed proposed structure\n\n\n## Dataset\n\n#### Description   \na cross-section from 1998-1999  \nnumber of observations: 420  \nobservation: schools  \ncountry: United States\n\n#### Columns\n- `distcod`: district code\n- `county`: county\n- `district`: district\n- `grspan`: grade span of district\n- `enrltot`: total enrollment \n- `teachers`: number of teachers\n- `calwpct`: percent qualifying for CalWORKS\n- `mealpct`: percent qualifying for reduced-price lunch\n- `computer`: number of computers\n- `testscr`: average test score (read.scr+math.scr)/2\n- `compstu`: computer per student\n- `expnstu`: expenditure per student\n- `str`: student teacher ratio\n- `avginc`: district average income\n- `elpct`: percent of English learners\n- `readscr`: average reading score\n- `mathscr`: average math score\n\n#### Source\nCalifornia Department of Education https://www.cde.ca.gov. \n\n\n## Used Tools\n- [DEAP](https://github.com/deap/deap) as framework for genetic algorithms\n- [HALerium](https://hal.erium.io/) to evaluate fitness of causal structure\n- [Streamlit](https://streamlit.io/) for the web UI\n\n\n## Usage\n\n### Install\nAll dependencies are stored in the `requirements.txt` and can be installed using `pip install -r requirements.txt`.\n\n### Run UI\n\nTo run the web UI run `streamlit run src/main.py` from to root folder of this project from to root folder of this project.\n\n### Run Genetic Algorithm \n\nThe execution of the genetic algorithm can be a fairly long-running process. Because of this, the UI does not support interactive updates on the progress of the run.\nInstead, it's recommended to run the optimization process from the terminal by executing `python src/ga_library.py`\n\n\n\n## Note\nThis is an _educational tool_ intended as showcase how a **Genetic Algorithm** can be applied to a real problem.  \nIt does **not** try to challenge the state-of-the-art nor does it use any novel operations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagier%2Fhalga","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagier%2Fhalga","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagier%2Fhalga/lists"}