abmfact 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- abmfact-0.1.0/.gitignore +17 -0
- abmfact-0.1.0/CHANGELOG.md +23 -0
- abmfact-0.1.0/CITATION.cff +44 -0
- abmfact-0.1.0/LICENSE +202 -0
- abmfact-0.1.0/NOTICE +4 -0
- abmfact-0.1.0/PKG-INFO +244 -0
- abmfact-0.1.0/README.md +208 -0
- abmfact-0.1.0/assets/how-it-works-dark.svg +121 -0
- abmfact-0.1.0/assets/how-it-works.svg +121 -0
- abmfact-0.1.0/assets/logo-dark.svg +23 -0
- abmfact-0.1.0/assets/logo.svg +23 -0
- abmfact-0.1.0/assets/mark.svg +22 -0
- abmfact-0.1.0/assets/matrix-dark.svg +87 -0
- abmfact-0.1.0/assets/matrix.svg +87 -0
- abmfact-0.1.0/assets/social-preview.png +0 -0
- abmfact-0.1.0/docs/README.md +8 -0
- abmfact-0.1.0/docs/adapters.md +81 -0
- abmfact-0.1.0/docs/checks.md +37 -0
- abmfact-0.1.0/docs/claims.md +49 -0
- abmfact-0.1.0/docs/concepts.md +40 -0
- abmfact-0.1.0/docs/statistics.md +63 -0
- abmfact-0.1.0/docs/zoo.md +42 -0
- abmfact-0.1.0/examples/README.md +15 -0
- abmfact-0.1.0/examples/command/audit.yaml +25 -0
- abmfact-0.1.0/examples/command/voter.py +27 -0
- abmfact-0.1.0/examples/mesa_sir/audit.yaml +35 -0
- abmfact-0.1.0/examples/mesa_sir/mesa_sir.py +87 -0
- abmfact-0.1.0/examples/zoo/audit.yaml +48 -0
- abmfact-0.1.0/pyproject.toml +101 -0
- abmfact-0.1.0/src/abmfact/__init__.py +37 -0
- abmfact-0.1.0/src/abmfact/__main__.py +3 -0
- abmfact-0.1.0/src/abmfact/adapters.py +364 -0
- abmfact-0.1.0/src/abmfact/audit.py +442 -0
- abmfact-0.1.0/src/abmfact/checks.py +88 -0
- abmfact-0.1.0/src/abmfact/claims.py +195 -0
- abmfact-0.1.0/src/abmfact/cli.py +169 -0
- abmfact-0.1.0/src/abmfact/config.py +194 -0
- abmfact-0.1.0/src/abmfact/demo.py +68 -0
- abmfact-0.1.0/src/abmfact/diagnose.py +88 -0
- abmfact-0.1.0/src/abmfact/knobs.py +118 -0
- abmfact-0.1.0/src/abmfact/py.typed +0 -0
- abmfact-0.1.0/src/abmfact/report.py +325 -0
- abmfact-0.1.0/src/abmfact/stats.py +189 -0
- abmfact-0.1.0/src/abmfact/zoo.py +304 -0
- abmfact-0.1.0/tests/conftest.py +15 -0
- abmfact-0.1.0/tests/test_adapters.py +178 -0
- abmfact-0.1.0/tests/test_audit.py +151 -0
- abmfact-0.1.0/tests/test_claims.py +98 -0
- abmfact-0.1.0/tests/test_cli.py +96 -0
- abmfact-0.1.0/tests/test_config.py +60 -0
- abmfact-0.1.0/tests/test_diagnose.py +21 -0
- abmfact-0.1.0/tests/test_knobs.py +33 -0
- abmfact-0.1.0/tests/test_matrix.py +17 -0
- abmfact-0.1.0/tests/test_mesa.py +48 -0
- abmfact-0.1.0/tests/test_report.py +60 -0
- abmfact-0.1.0/tests/test_stats.py +116 -0
- abmfact-0.1.0/tests/test_zoo.py +71 -0
- abmfact-0.1.0/tests/toymodels.py +59 -0
abmfact-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes are recorded here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
|
|
5
|
+
[semantic versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-10-18
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Audit files in YAML: model, parameters, claims and budget.
|
|
14
|
+
- Claims with threshold, range and monotone tests, and a safe metric grammar.
|
|
15
|
+
- Seven checks: determinism, update order, agent order, random streams, grid placement, time step and
|
|
16
|
+
population scale.
|
|
17
|
+
- Verdicts ROBUST, SHIFTED, FRAGILE, INCONCLUSIVE, BASELINE_FAILS, NOT_TESTABLE and SKIPPED, with
|
|
18
|
+
reasons, seeds needed and reproducer commands.
|
|
19
|
+
- Diagnosis of the likely cause from the pattern of flagged checks.
|
|
20
|
+
- Python, Mesa, NetLogo and command adapters.
|
|
21
|
+
- Outputs: results.json, a self-contained report.html and an RO-Crate 1.1 record.
|
|
22
|
+
- The planted-fault zoo and an acceptance test requiring a diagonal detection matrix.
|
|
23
|
+
- Command line: run, check, demo, init and replay.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use ABMfact, please cite it as below."
|
|
3
|
+
title: "ABMfact: is it a finding or an artefact?"
|
|
4
|
+
abstract: >-
|
|
5
|
+
ABMfact audits the conclusions of agent-based models against implementation artefacts. It reruns a
|
|
6
|
+
model under changes that a correct implementation must not care about, such as activation order,
|
|
7
|
+
agent labels, random streams, grid placement, time step and population size, and reports which
|
|
8
|
+
stated conclusions survive, with intervals and reproducible commands.
|
|
9
|
+
type: software
|
|
10
|
+
authors:
|
|
11
|
+
- family-names: Hemedan
|
|
12
|
+
given-names: Ahmed
|
|
13
|
+
version: 0.1.0
|
|
14
|
+
license: Apache-2.0
|
|
15
|
+
repository-code: "https://github.com/a7med7emedan/ABMfact"
|
|
16
|
+
keywords:
|
|
17
|
+
- agent-based modelling
|
|
18
|
+
- verification
|
|
19
|
+
- reproducibility
|
|
20
|
+
- artefacts
|
|
21
|
+
- simulation
|
|
22
|
+
references:
|
|
23
|
+
- type: article
|
|
24
|
+
title: "Errors and artefacts in agent-based modelling"
|
|
25
|
+
authors:
|
|
26
|
+
- family-names: Galán
|
|
27
|
+
given-names: José Manuel
|
|
28
|
+
- family-names: Izquierdo
|
|
29
|
+
given-names: Luis R.
|
|
30
|
+
- family-names: Izquierdo
|
|
31
|
+
given-names: Segismundo S.
|
|
32
|
+
- family-names: Santos
|
|
33
|
+
given-names: José Ignacio
|
|
34
|
+
- family-names: del Olmo
|
|
35
|
+
given-names: Ricardo
|
|
36
|
+
- family-names: López-Paredes
|
|
37
|
+
given-names: Adolfo
|
|
38
|
+
- family-names: Edmonds
|
|
39
|
+
given-names: Bruce
|
|
40
|
+
journal: "Journal of Artificial Societies and Social Simulation"
|
|
41
|
+
volume: 12
|
|
42
|
+
issue: 1
|
|
43
|
+
year: 2009
|
|
44
|
+
url: "https://www.jasss.org/12/1/1.html"
|
abmfact-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
abmfact-0.1.0/NOTICE
ADDED
abmfact-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: abmfact
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Is it a finding or an artefact? Audits the conclusions of agent-based models against implementation artefacts.
|
|
5
|
+
Project-URL: Homepage, https://github.com/a7med7emedan/ABMfact
|
|
6
|
+
Project-URL: Source, https://github.com/a7med7emedan/ABMfact
|
|
7
|
+
Project-URL: Documentation, https://github.com/a7med7emedan/ABMfact/tree/main/docs
|
|
8
|
+
Project-URL: Issues, https://github.com/a7med7emedan/ABMfact/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/a7med7emedan/ABMfact/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Ahmed Hemedan
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: NOTICE
|
|
14
|
+
Keywords: abm,agent-based-model,agent-based-modelling,artefacts,computational-science,mesa,metamorphic-testing,netlogo,reproducibility,research-software,robustness,simulation,validation,verification
|
|
15
|
+
Classifier: Development Status :: 3 - Alpha
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
24
|
+
Classifier: Topic :: Software Development :: Testing
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.11
|
|
27
|
+
Requires-Dist: numpy>=1.26
|
|
28
|
+
Requires-Dist: pyyaml>=6.0
|
|
29
|
+
Requires-Dist: scipy>=1.11
|
|
30
|
+
Provides-Extra: mesa
|
|
31
|
+
Requires-Dist: mesa>=3.1; extra == 'mesa'
|
|
32
|
+
Requires-Dist: networkx>=3.0; extra == 'mesa'
|
|
33
|
+
Provides-Extra: netlogo
|
|
34
|
+
Requires-Dist: pynetlogo>=0.5; extra == 'netlogo'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<picture>
|
|
39
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/a7med7emedan/ABMfact/main/assets/logo-dark.svg">
|
|
40
|
+
<img src="https://raw.githubusercontent.com/a7med7emedan/ABMfact/main/assets/logo.svg" alt="ABMfact" width="420">
|
|
41
|
+
</picture>
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<a href="https://github.com/a7med7emedan/ABMfact/actions/workflows/tests.yml"><img src="https://github.com/a7med7emedan/ABMfact/actions/workflows/tests.yml/badge.svg" alt="tests"></a>
|
|
46
|
+
<img src="https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue" alt="Python 3.11 to 3.13">
|
|
47
|
+
<a href="https://github.com/a7med7emedan/ABMfact/blob/main/LICENSE"><img src="https://img.shields.io/badge/licence-Apache--2.0-green" alt="Apache-2.0"></a>
|
|
48
|
+
</p>
|
|
49
|
+
|
|
50
|
+
**ABMfact tells you whether the conclusions of an agent-based model are findings or implementation
|
|
51
|
+
artefacts.**
|
|
52
|
+
|
|
53
|
+
You state your model's conclusions as checkable claims. ABMfact reruns the model under changes that a
|
|
54
|
+
correct implementation must not care about: activation order, agent labels, random streams, where the
|
|
55
|
+
world sits on the grid, the time step and the population size. It then reports, claim by claim, which
|
|
56
|
+
conclusions survive. Every verdict comes with an interval, a reason and a one-line command that
|
|
57
|
+
reproduces it.
|
|
58
|
+
|
|
59
|
+
<p align="center">
|
|
60
|
+
<picture>
|
|
61
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/a7med7emedan/ABMfact/main/assets/how-it-works-dark.svg">
|
|
62
|
+
<img src="https://raw.githubusercontent.com/a7med7emedan/ABMfact/main/assets/how-it-works.svg" alt="The audit pipeline: a model and its claims run under a baseline and six perturbed conditions, over many seeds; intervals and equivalence tests give a verdict per claim and check (ROBUST, SHIFTED or FRAGILE), written to report.html, results.json and an RO-Crate record." width="100%">
|
|
63
|
+
</picture>
|
|
64
|
+
</p>
|
|
65
|
+
|
|
66
|
+
## Why
|
|
67
|
+
|
|
68
|
+
Galán et al. (2009) separated two ways a model can mislead. An *error* is code that does not do what
|
|
69
|
+
the modeller meant. An *artefact* is a result produced by an implementation choice that is not part of
|
|
70
|
+
the theory, such as the order agents act in. Both are hard to see by reading code, and both survive
|
|
71
|
+
peer review. ABMfact turns that distinction into automatic, repeatable tests, so the question "is this
|
|
72
|
+
an artefact?" gets an answer with a seed attached.
|
|
73
|
+
|
|
74
|
+
## Quick start
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install abmfact # add [mesa] or [netlogo] for those frameworks
|
|
78
|
+
abmfact demo --jobs 4 # audit the planted-fault zoo (about a minute on four cores)
|
|
79
|
+
abmfact init # write a commented audit.yaml for your model
|
|
80
|
+
abmfact run audit.yaml --out results/
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`results/report.html` opens in any browser. `abmfact check audit.yaml` exits with status 1 when any claim
|
|
84
|
+
is fragile, so it fits in continuous integration.
|
|
85
|
+
|
|
86
|
+
## What you write
|
|
87
|
+
|
|
88
|
+
One YAML file: the model, its parameters, the claims and a budget.
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
model:
|
|
92
|
+
adapter: python
|
|
93
|
+
target: mypackage.model:run # run(params, seed, knobs) -> dict of outputs
|
|
94
|
+
supports: # the implementation choices your model can vary
|
|
95
|
+
update_order: {values: [random, id, synchronous], default: random}
|
|
96
|
+
agent_order: true
|
|
97
|
+
grid: true
|
|
98
|
+
dt_scale: true
|
|
99
|
+
pop_scale: true
|
|
100
|
+
|
|
101
|
+
params: {beta: 0.4, gamma: 0.1}
|
|
102
|
+
|
|
103
|
+
claims:
|
|
104
|
+
- id: C1
|
|
105
|
+
statement: "most of the population is infected"
|
|
106
|
+
metric: attack_rate
|
|
107
|
+
test: greater_than
|
|
108
|
+
value: 0.6
|
|
109
|
+
- id: C2
|
|
110
|
+
statement: "the attack rate rises with transmission"
|
|
111
|
+
metric: attack_rate
|
|
112
|
+
test: monotone_increasing
|
|
113
|
+
over: beta
|
|
114
|
+
where: {beta: [0.25, 0.4]}
|
|
115
|
+
- id: C3
|
|
116
|
+
statement: "the epidemic peaks within 25 time units"
|
|
117
|
+
metric: peak_time
|
|
118
|
+
test: less_than
|
|
119
|
+
value: 25
|
|
120
|
+
skip_checks:
|
|
121
|
+
population_scale: "peak time legitimately grows with system size"
|
|
122
|
+
|
|
123
|
+
budget: {seeds: 100, jobs: 4}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Claims test conclusions, not raw numbers, because a number can move while the conclusion holds. Write
|
|
127
|
+
them from the paper or the abstract before running anything.
|
|
128
|
+
|
|
129
|
+
## What you get
|
|
130
|
+
|
|
131
|
+
For example, auditing the zoo model with a stale-buffer bug (`abmfact.zoo:fault_stale_state`, claims as
|
|
132
|
+
in [examples/zoo/audit.yaml](https://github.com/a7med7emedan/ABMfact/blob/main/examples/zoo/audit.yaml)) gives:
|
|
133
|
+
|
|
134
|
+
| Claim | determinism | update order | agent order | rng streams | grid | time step | population |
|
|
135
|
+
|---|---|---|---|---|---|---|---|
|
|
136
|
+
| C1 most are infected | ROBUST | **SHIFTED** | ROBUST | ROBUST | ROBUST | ROBUST | ROBUST |
|
|
137
|
+
| C2 rises with beta | ROBUST | **SHIFTED** | ROBUST | ROBUST | ROBUST | ROBUST | ROBUST |
|
|
138
|
+
| C3 peak below 50% | ROBUST | **SHIFTED** | ROBUST | ROBUST | ROBUST | ROBUST | ROBUST |
|
|
139
|
+
| C4 peaks by t = 25 | ROBUST | **FRAGILE** | ROBUST | ROBUST | ROBUST | ROBUST | SKIPPED |
|
|
140
|
+
|
|
141
|
+
with the likely cause: *stale or partial state reads: agents see a state that depends on the scheduling
|
|
142
|
+
path*.
|
|
143
|
+
|
|
144
|
+
Each run writes three files:
|
|
145
|
+
|
|
146
|
+
- `report.html`: the verdict table, one interval plot per claim and condition, likely causes, and
|
|
147
|
+
reproducer commands. Self-contained, light and dark.
|
|
148
|
+
- `results.json`: every interval, comparison and verdict, for scripts and CI. Identical across reruns
|
|
149
|
+
apart from the timestamp.
|
|
150
|
+
- `ro-crate-metadata.json`: an RO-Crate 1.1 record of the audit file, results and report, with SHA-256
|
|
151
|
+
hashes, so the audit itself can be archived and cited.
|
|
152
|
+
|
|
153
|
+
## The checks
|
|
154
|
+
|
|
155
|
+
| Check | Question | Typical cause when it fails |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| `determinism` | Does the same seed always give the same result? | an unseeded generator, set or dict iteration order, wall-clock time |
|
|
158
|
+
| `update_order` | Does the conclusion survive a different activation order? | stale or partial state reads, buffers reused between steps |
|
|
159
|
+
| `agent_order` | Does it survive relabelling the agents? | `agents[:k]`, ties broken by id |
|
|
160
|
+
| `rng_streams` | Does it survive fresh, independent random streams? | a hard-coded seed, streams shared between processes |
|
|
161
|
+
| `grid` | Does it survive moving or rotating the world on the torus? | a boundary that does not wrap, absolute array positions |
|
|
162
|
+
| `time_step` | Does it survive halving the time step? | probabilities not converted with the current step |
|
|
163
|
+
| `population_scale` | Does it survive doubling the population at fixed density? | a size or count fixed at the calibration value |
|
|
164
|
+
|
|
165
|
+
A check needs the model to honour its knob. When a model does not, the check is reported as
|
|
166
|
+
`NOT_TESTABLE`, never skipped silently. The `rng_streams` check always runs: when a model does not manage
|
|
167
|
+
its own streams, ABMfact remaps the seed.
|
|
168
|
+
|
|
169
|
+
## Verdicts
|
|
170
|
+
|
|
171
|
+
| Verdict | Meaning |
|
|
172
|
+
|---|---|
|
|
173
|
+
| `ROBUST` | the claim holds under every variant, and every result is statistically equivalent to baseline |
|
|
174
|
+
| `SHIFTED` | the claim still holds, but a result moved beyond its tolerance, or its spread doubled or halved |
|
|
175
|
+
| `FRAGILE` | the claim fails under a variant, or the same seed gave a different result |
|
|
176
|
+
| `INCONCLUSIVE` | the intervals are too wide to decide; the report says how many seeds would settle it |
|
|
177
|
+
| `BASELINE_FAILS` | the claim does not hold even before anything is changed |
|
|
178
|
+
| `NOT_TESTABLE`, `SKIPPED` | the model does not expose the knob, or the claim declares the check out of scope, with a reason |
|
|
179
|
+
|
|
180
|
+
Decisions use one-sided tests at `alpha` (0.05 by default, so 90% intervals) and a three-outcome
|
|
181
|
+
equivalence test against a tolerance, 10% of the baseline mean unless the claim sets one. See
|
|
182
|
+
[docs/statistics.md](https://github.com/a7med7emedan/ABMfact/blob/main/docs/statistics.md).
|
|
183
|
+
|
|
184
|
+
## Validation: the planted-fault zoo
|
|
185
|
+
|
|
186
|
+
A checker is only as good as its evidence that it catches what it claims to catch, and nothing else.
|
|
187
|
+
`abmfact.zoo` holds one clean SIR model on a torus and seven copies of it, each with one realistic bug.
|
|
188
|
+
`abmfact demo` audits all eight with every check. The figure below is drawn from a real run with 100 seeds
|
|
189
|
+
per condition by [scripts/make_figures.py](https://github.com/a7med7emedan/ABMfact/blob/main/scripts/make_figures.py).
|
|
190
|
+
|
|
191
|
+
<p align="center">
|
|
192
|
+
<picture>
|
|
193
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/a7med7emedan/ABMfact/main/assets/matrix-dark.svg">
|
|
194
|
+
<img src="https://raw.githubusercontent.com/a7med7emedan/ABMfact/main/assets/matrix.svg" alt="Planted-fault detection matrix: each of the seven faulty models is caught only by its own check, and the clean model by none." width="100%">
|
|
195
|
+
</picture>
|
|
196
|
+
</p>
|
|
197
|
+
|
|
198
|
+
The test suite requires this exact matrix:
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
determinism update order agent order rng streams grid time step population scale
|
|
202
|
+
clean . . . . . . .
|
|
203
|
+
nondeterminism CAUGHT . . . . . .
|
|
204
|
+
stale_state . CAUGHT . . . . .
|
|
205
|
+
id_dependence . . CAUGHT . . . .
|
|
206
|
+
ignored_seed . . . CAUGHT . . .
|
|
207
|
+
boundary . . . . CAUGHT . .
|
|
208
|
+
dt_unscaled . . . . . CAUGHT .
|
|
209
|
+
density . . . . . . CAUGHT
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Each fault is caught by its own check and by no other, and the clean model is robust everywhere. The
|
|
213
|
+
bugs are described in [docs/zoo.md](https://github.com/a7med7emedan/ABMfact/blob/main/docs/zoo.md) and marked `# FAULT` in the source.
|
|
214
|
+
|
|
215
|
+
## Adapters
|
|
216
|
+
|
|
217
|
+
| Adapter | For | Notes |
|
|
218
|
+
|---|---|---|
|
|
219
|
+
| `python` | any `run(params, seed, knobs)` callable | the fastest path |
|
|
220
|
+
| `mesa` | Mesa 3 model classes | knobs map to constructor keywords; `pip install "abmfact[mesa]"` |
|
|
221
|
+
| `netlogo` | `.nlogo` models through pynetlogo | knobs map to globals; needs a local NetLogo |
|
|
222
|
+
| `command` | anything else: R, Julia, Java, C++ | reads JSON on stdin, prints JSON on stdout |
|
|
223
|
+
|
|
224
|
+
Working examples for each live in [examples/](https://github.com/a7med7emedan/ABMfact/tree/main/examples). See [docs/adapters.md](https://github.com/a7med7emedan/ABMfact/blob/main/docs/adapters.md).
|
|
225
|
+
|
|
226
|
+
## Limits
|
|
227
|
+
|
|
228
|
+
ABMfact checks implementation choices that should not matter. It does not check whether the model is a
|
|
229
|
+
good description of the world, and it cannot find a bug that changes no stated claim. Its power depends
|
|
230
|
+
on the seeds you give it: an `INCONCLUSIVE` verdict is an honest answer, not a pass. Many comparisons are
|
|
231
|
+
made in one audit, so treat a single marginal `SHIFTED` as a lead to investigate, not a conclusion.
|
|
232
|
+
|
|
233
|
+
## Citing
|
|
234
|
+
|
|
235
|
+
If ABMfact helps your work, please cite it using [CITATION.cff](https://github.com/a7med7emedan/ABMfact/blob/main/CITATION.cff) (GitHub shows a "Cite this
|
|
236
|
+
repository" button). The idea it implements comes from:
|
|
237
|
+
|
|
238
|
+
> Galán, J. M., Izquierdo, L. R., Izquierdo, S. S., Santos, J. I., del Olmo, R., López-Paredes, A., &
|
|
239
|
+
> Edmonds, B. (2009). Errors and artefacts in agent-based modelling. *Journal of Artificial Societies and
|
|
240
|
+
> Social Simulation*, 12(1), 1. https://www.jasss.org/12/1/1.html
|
|
241
|
+
|
|
242
|
+
## Licence
|
|
243
|
+
|
|
244
|
+
Apache-2.0. See [LICENSE](https://github.com/a7med7emedan/ABMfact/blob/main/LICENSE).
|