{"id":13342924,"url":"https://github.com/QuadnucYard/PGM-ExactInference","last_synced_at":"2025-03-12T03:30:39.194Z","repository":{"id":65379745,"uuid":"498545306","full_name":"QuadnucYard/PGM-ExactInference","owner":"QuadnucYard","description":"曾经是高志强老师的概率图模型精确推理作业，现已使用XMake和c++23魔改","archived":false,"fork":false,"pushed_at":"2023-06-13T13:41:01.000Z","size":519,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T08:11:23.788Z","etag":null,"topics":["cpp23","pgm","xmake"],"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/QuadnucYard.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-01T00:59:00.000Z","updated_at":"2024-05-13T09:37:53.000Z","dependencies_parsed_at":"2024-10-24T05:19:48.962Z","dependency_job_id":"48994d19-b12a-47fa-9dd1-4b29a2164f88","html_url":"https://github.com/QuadnucYard/PGM-ExactInference","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/QuadnucYard%2FPGM-ExactInference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadnucYard%2FPGM-ExactInference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadnucYard%2FPGM-ExactInference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuadnucYard%2FPGM-ExactInference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QuadnucYard","download_url":"https://codeload.github.com/QuadnucYard/PGM-ExactInference/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243150670,"owners_count":20244436,"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":["cpp23","pgm","xmake"],"created_at":"2024-07-29T19:30:08.121Z","updated_at":"2025-03-12T03:30:38.907Z","avatar_url":"https://github.com/QuadnucYard.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PGM-ExactInference\n\n高志强老师的概率图模型精确推理作业，曾经使用 `c++20` 重构代码，现在使用 `c++23` 并且配合更专业的开发工具。\n\n附带一些自己尝试编写的 `ranges`/`views` 算法。\n\n经过很多次试验，对于给定数据的查询输出无误，其他情况未知。欢迎来 contribute 数据。\n\n`master` 分支为最新版，x64 开发环境。\n\n## ChangeLog\n\n### v1.0.0 pre1\n\n基于 XMake 构建，重构项目结构……\n\nCLI 暂时去掉了。\n\n### v0.5.0\n\n进一步精简文件，统一 IO 接口。**彻底移除 xml 支持。**\n\n### v0.4.0\n\n在因子类的基础上重写团树法（`CliqueTreeMethod`），并增加团树类（`CliqueTree`）。\n\n调整 `CliqueTree.yaml` 的键名 `variables`。\n\n没有维护 `xml` 版，预计将彻底移除支持。\n\n### v0.3.0\n\n重写因子类、BeyasianNetwork、BNSumProduct。现在 `Factor` 类支持高效的因子存储和操作。可能可以利用 `valarray` 的一些操作进一步化简。\n\n修改 `BayesianNetwork.yaml` 的存储结构，把变量信息和网络结点分离。\n\n### v0.2.0\n\nI/O 已从推理结构中分离，并加入异常处理，输入输出文件名可在 `ExactInferenceDlg_User.cpp` 中修改。\n\n暂存到 `beta` 分支。\n\n### v0.1.0\n\n支持 YAML。所有 `.xml` 经过格式化，转为 utf8 格式，把该死的用于分隔值的 `、` 换成 `, `，且修改代码不再支持 `、，；`。\n\n无 YAML 版暂存到 `xml-end` 分支。\n\n## Dependency\n\n- `vcpkg::ryml`：YAML 解析库。\n\n### yaml 文件结构\n\n#### `BayesianNetwork.yaml`\n\n`variables` 为变量集，key 为结点 id，值含义比较显然。`nodes` 下，`parants` 为父结点数组，没有父结点的结点可以省略 `parants`，或置为 `null`；`CPT` 为概率分布顺序同 `xml` 版。\n\n#### `CliqueTree.yaml`\n\n相比 `.xml` 版更改了很多。`root` 为根结点 id。`variables` 为变量，需要使用 `numValues` 显式说明每个变量的取值数。\n\n`cliques` 的 key 为团 id，`vars` 为团的变量，`vals` 按顺序给出 CPT，相比 `.xml` 不需要再给出具体因子。\n\n`edges` 为团之间的无向边。每个数组中两个元素为边的端点 id。\n\n【重要】要求团 id 为从 0 开始的连续自然数。\n\n#### `BayesianNetwork_Query.yaml` / `CliqueTree_Query.yaml`\n\n内容基本相同，只不过 CT 版不需要 `eliminate` 项。`marginal` 和 `given` 均以 `id: value` 形式给出因子。`eliminate` 为待消除因子 id 数组。\n\n#### `Output.yaml` / `CliqueTree_Output.yaml`\n\n内容应当完全一样，表示查询结果数组。\n\n## 开发环境\n\n## TODO（有生之年）\n\n1. 使用轻量级 GUI 库，可视化图。\n2. 增加从贝叶斯网生成团树的算法。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQuadnucYard%2FPGM-ExactInference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FQuadnucYard%2FPGM-ExactInference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQuadnucYard%2FPGM-ExactInference/lists"}