coordinationz 0.3.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.
- coordinationz-0.3.0/.github/workflows/build-publish-pypi.yml +113 -0
- coordinationz-0.3.0/.gitignore +179 -0
- coordinationz-0.3.0/LICENSE +20 -0
- coordinationz-0.3.0/PKG-INFO +82 -0
- coordinationz-0.3.0/README.md +50 -0
- coordinationz-0.3.0/config_paper.toml +29 -0
- coordinationz-0.3.0/docs/releasing.md +19 -0
- coordinationz-0.3.0/docs/replication.md +54 -0
- coordinationz-0.3.0/meson.build +18 -0
- coordinationz-0.3.0/pipeline/aggregate_indicator_variants.py +585 -0
- coordinationz-0.3.0/pipeline/indicators.py +105 -0
- coordinationz-0.3.0/pipeline/preprocess/preprocessIO.py +26 -0
- coordinationz-0.3.0/pyproject.toml +53 -0
- coordinationz-0.3.0/reproduction/check_null_model.py +150 -0
- coordinationz-0.3.0/reproduction/cohort.py +21 -0
- coordinationz-0.3.0/reproduction/evaluate_null_aggregations.py +216 -0
- coordinationz-0.3.0/reproduction/figures/fig_aggregation.py +134 -0
- coordinationz-0.3.0/reproduction/figures/fig_auc_thresholds.py +76 -0
- coordinationz-0.3.0/reproduction/figures/fig_data.py +108 -0
- coordinationz-0.3.0/reproduction/figures/fig_dataset_auc_main.py +82 -0
- coordinationz-0.3.0/reproduction/figures/fig_nullmodel.py +186 -0
- coordinationz-0.3.0/reproduction/figures/fig_overview.py +96 -0
- coordinationz-0.3.0/reproduction/figures/fig_similarity.py +90 -0
- coordinationz-0.3.0/reproduction/figures/fig_supp.py +65 -0
- coordinationz-0.3.0/reproduction/figures/fig_variants.py +164 -0
- coordinationz-0.3.0/reproduction/figures/figstyle.py +293 -0
- coordinationz-0.3.0/reproduction/figures/make_all.py +48 -0
- coordinationz-0.3.0/reproduction/figures/naming.py +82 -0
- coordinationz-0.3.0/reproduction/figures/toy.py +82 -0
- coordinationz-0.3.0/reproduction/inputs/benchmark_mapping.csv +10 -0
- coordinationz-0.3.0/reproduction/inputs/dataset_populations.csv +28 -0
- coordinationz-0.3.0/reproduction/inputs/figdata/null_examples.json +506 -0
- coordinationz-0.3.0/reproduction/inputs/figdata/similarity_pvalue_hist_cuba_082020_tweets.npz +0 -0
- coordinationz-0.3.0/reproduction/inputs/null_aggregation_metrics.csv +1459 -0
- coordinationz-0.3.0/reproduction/inputs/null_aggregation_summary.csv +163 -0
- coordinationz-0.3.0/reproduction/prepare_figure_data.py +141 -0
- coordinationz-0.3.0/source/coordinationz/__init__.py +7 -0
- coordinationz-0.3.0/source/coordinationz/config.py +44 -0
- coordinationz-0.3.0/source/coordinationz/fastcosine.py +437 -0
- coordinationz-0.3.0/source/coordinationz/indicator_utilities.py +215 -0
- coordinationz-0.3.0/source/coordinationz/meson.build +17 -0
- coordinationz-0.3.0/source/coordinationz/network.py +226 -0
- coordinationz-0.3.0/source/coordinationz/nullmodel.py +637 -0
- coordinationz-0.3.0/source/coordinationz/preprocess_utilities.py +217 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVBasicArrays.h +1209 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVCommons.h +1081 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVDictionary.c +478 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVDictionary.h +144 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVDistribution.c +153 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVDistribution.h +68 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVGridUtilities.h +330 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVNetwork.c +2819 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVNetwork.h +233 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVNetworkCentrality.c +949 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVNetworkCentrality.h +20 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVSet.c +728 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVSet.h +160 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVSimpleQueue.c +107 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/CVSimpleQueue.h +47 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/fib.c +740 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/fib.h +75 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/fibpriv.h +99 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/utarray.h +232 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/uthash.h +948 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/utlist.h +757 -0
- coordinationz-0.3.0/source/fastcosine_core/cxnetwork/utstring.h +392 -0
- coordinationz-0.3.0/source/fastcosine_core/fastcosine_core.c +2625 -0
- coordinationz-0.3.0/source/fastcosine_core/meson.build +27 -0
- coordinationz-0.3.0/source/fastcosine_core/numpyutil.h +64 -0
- coordinationz-0.3.0/source/meson.build +12 -0
- coordinationz-0.3.0/tests/test_replication.py +109 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
name: Test and publish CoordinationZ
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main, 'codex/paper-replication']
|
|
7
|
+
tags: ['v*']
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
replication:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v6
|
|
18
|
+
- uses: actions/setup-python@v6
|
|
19
|
+
with:
|
|
20
|
+
python-version: '3.11'
|
|
21
|
+
- run: python -m pip install '.[figures,test]'
|
|
22
|
+
- run: python -m pytest -q
|
|
23
|
+
- run: python reproduction/check_null_model.py --exact-only
|
|
24
|
+
- run: python reproduction/figures/make_all.py
|
|
25
|
+
|
|
26
|
+
wheels:
|
|
27
|
+
strategy:
|
|
28
|
+
fail-fast: false
|
|
29
|
+
matrix:
|
|
30
|
+
include:
|
|
31
|
+
- runner: ubuntu-latest
|
|
32
|
+
arch: x86_64
|
|
33
|
+
- runner: macos-15
|
|
34
|
+
arch: arm64
|
|
35
|
+
- runner: macos-15-intel
|
|
36
|
+
arch: x86_64
|
|
37
|
+
- runner: windows-latest
|
|
38
|
+
arch: AMD64
|
|
39
|
+
runs-on: ${{ matrix.runner }}
|
|
40
|
+
env:
|
|
41
|
+
CIBW_BUILD: cp310-* cp311-* cp312-*
|
|
42
|
+
CIBW_SKIP: '*-musllinux*'
|
|
43
|
+
CIBW_ARCHS: ${{ matrix.arch }}
|
|
44
|
+
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
|
|
45
|
+
CIBW_TEST_REQUIRES: pytest
|
|
46
|
+
CIBW_TEST_COMMAND: python -m pytest -q "{project}/tests"
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v6
|
|
49
|
+
- uses: actions/setup-python@v6
|
|
50
|
+
with:
|
|
51
|
+
python-version: '3.12'
|
|
52
|
+
- run: python -m pip install cibuildwheel==3.3.1
|
|
53
|
+
- run: python -m cibuildwheel --output-dir dist
|
|
54
|
+
- uses: actions/upload-artifact@v4
|
|
55
|
+
with:
|
|
56
|
+
name: wheels-${{ matrix.runner }}
|
|
57
|
+
path: dist/*.whl
|
|
58
|
+
if-no-files-found: error
|
|
59
|
+
|
|
60
|
+
sdist:
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@v6
|
|
64
|
+
- uses: actions/setup-python@v6
|
|
65
|
+
with:
|
|
66
|
+
python-version: '3.11'
|
|
67
|
+
- run: python -m pip install build twine
|
|
68
|
+
- run: python -m build --sdist
|
|
69
|
+
- run: python -m twine check --strict dist/*
|
|
70
|
+
- run: python -m pip install dist/*.tar.gz
|
|
71
|
+
- run: python reproduction/check_null_model.py --exact-only
|
|
72
|
+
- uses: actions/upload-artifact@v4
|
|
73
|
+
with:
|
|
74
|
+
name: sdist
|
|
75
|
+
path: dist/*.tar.gz
|
|
76
|
+
if-no-files-found: error
|
|
77
|
+
|
|
78
|
+
publish:
|
|
79
|
+
if: github.repository == 'osome-iu/coordinationz' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
|
80
|
+
needs: [replication, wheels, sdist]
|
|
81
|
+
runs-on: ubuntu-latest
|
|
82
|
+
permissions:
|
|
83
|
+
contents: read
|
|
84
|
+
id-token: write
|
|
85
|
+
steps:
|
|
86
|
+
- uses: actions/download-artifact@v4
|
|
87
|
+
with:
|
|
88
|
+
path: dist
|
|
89
|
+
merge-multiple: true
|
|
90
|
+
- uses: actions/setup-python@v6
|
|
91
|
+
with:
|
|
92
|
+
python-version: '3.11'
|
|
93
|
+
- run: python -m pip install twine
|
|
94
|
+
- name: Validate release artifacts
|
|
95
|
+
shell: bash
|
|
96
|
+
run: |
|
|
97
|
+
python -m twine check --strict dist/*
|
|
98
|
+
python - <<'PY'
|
|
99
|
+
from pathlib import Path
|
|
100
|
+
from packaging.utils import parse_sdist_filename, parse_wheel_filename
|
|
101
|
+
from packaging.version import Version
|
|
102
|
+
import os
|
|
103
|
+
|
|
104
|
+
expected = Version(os.environ["GITHUB_REF_NAME"].removeprefix("v"))
|
|
105
|
+
files = list(Path("dist").iterdir())
|
|
106
|
+
assert sum(path.name.endswith(".tar.gz") for path in files) == 1
|
|
107
|
+
assert sum(path.suffix == ".whl" for path in files) == 12
|
|
108
|
+
for path in files:
|
|
109
|
+
parse = parse_wheel_filename if path.suffix == ".whl" else parse_sdist_filename
|
|
110
|
+
name, version, *_ = parse(path.name)
|
|
111
|
+
assert name == "coordinationz" and version == expected, path.name
|
|
112
|
+
PY
|
|
113
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
.python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
+
# install all needed dependencies.
|
|
92
|
+
#Pipfile.lock
|
|
93
|
+
|
|
94
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
+
__pypackages__/
|
|
96
|
+
|
|
97
|
+
# Celery stuff
|
|
98
|
+
celerybeat-schedule
|
|
99
|
+
celerybeat.pid
|
|
100
|
+
|
|
101
|
+
# SageMath parsed files
|
|
102
|
+
*.sage.py
|
|
103
|
+
|
|
104
|
+
# Environments
|
|
105
|
+
.env
|
|
106
|
+
.venv
|
|
107
|
+
env/
|
|
108
|
+
venv/
|
|
109
|
+
ENV/
|
|
110
|
+
env.bak/
|
|
111
|
+
venv.bak/
|
|
112
|
+
|
|
113
|
+
# Spyder project settings
|
|
114
|
+
.spyderproject
|
|
115
|
+
.spyproject
|
|
116
|
+
|
|
117
|
+
# Rope project settings
|
|
118
|
+
.ropeproject
|
|
119
|
+
|
|
120
|
+
# mkdocs documentation
|
|
121
|
+
/site
|
|
122
|
+
|
|
123
|
+
# mypy
|
|
124
|
+
.mypy_cache/
|
|
125
|
+
.dmypy.json
|
|
126
|
+
dmypy.json
|
|
127
|
+
|
|
128
|
+
# Pyre type checker
|
|
129
|
+
.pyre/
|
|
130
|
+
|
|
131
|
+
# General
|
|
132
|
+
.DS_Store
|
|
133
|
+
.AppleDouble
|
|
134
|
+
.LSOverride
|
|
135
|
+
|
|
136
|
+
# Icon must end with two \r
|
|
137
|
+
Icon
|
|
138
|
+
|
|
139
|
+
# Thumbnails
|
|
140
|
+
._*
|
|
141
|
+
|
|
142
|
+
# Mac Based
|
|
143
|
+
# Files that might appear in the root of a volume
|
|
144
|
+
.DocumentRevisions-V100
|
|
145
|
+
.fseventsd
|
|
146
|
+
.Spotlight-V100
|
|
147
|
+
.TemporaryItems
|
|
148
|
+
.Trashes
|
|
149
|
+
.VolumeIcon.icns
|
|
150
|
+
.com.apple.timemachine.donotpresent
|
|
151
|
+
|
|
152
|
+
# Directories potentially created on remote AFP share
|
|
153
|
+
.AppleDB
|
|
154
|
+
.AppleDesktop
|
|
155
|
+
Network Trash Folder
|
|
156
|
+
Temporary Items
|
|
157
|
+
.apdisk
|
|
158
|
+
.snakemake
|
|
159
|
+
.vscode
|
|
160
|
+
/Data
|
|
161
|
+
/Figures
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
#jobs
|
|
165
|
+
jobs/
|
|
166
|
+
*.job
|
|
167
|
+
*.out
|
|
168
|
+
plots/
|
|
169
|
+
data/
|
|
170
|
+
|
|
171
|
+
# Will ignore config.toml (Use template)
|
|
172
|
+
config.toml
|
|
173
|
+
/logs
|
|
174
|
+
# Local data and generated replication outputs
|
|
175
|
+
/Data/
|
|
176
|
+
/Outputs/
|
|
177
|
+
/reproduction/results/
|
|
178
|
+
/reproduction/rendered/
|
|
179
|
+
/config.local.toml
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2023-2024 Filipi Nascimento Silva and others
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: coordinationz
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Package to estimate activity-conditioned coordination in online behavior.
|
|
5
|
+
Author-Email: "Filipi N. Silva" <filipinascimento@gmail.com>, Manita Pote <potem@iu.edu>, Lake Yin <lakeyin@iu.edu>, David Axelrod <daaxelro@iu.edu>, Luca Luceri <lluceri@isi.edu>, Ashwin Balasubramanian <ashwinb@isi.edu>
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Intended Audience :: Developers
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Project-URL: Documentation, https://github.com/osome-iu/coordinationz#readme
|
|
14
|
+
Project-URL: Source, https://github.com/osome-iu/coordinationz
|
|
15
|
+
Project-URL: Tracker, https://github.com/osome-iu/coordinationz/issues
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Requires-Dist: numpy>=1.26
|
|
18
|
+
Requires-Dist: pandas>=2.1
|
|
19
|
+
Requires-Dist: scipy
|
|
20
|
+
Requires-Dist: tqdm
|
|
21
|
+
Requires-Dist: toml
|
|
22
|
+
Requires-Dist: igraph<1,>=0.11
|
|
23
|
+
Requires-Dist: xnetwork>=1.0.4
|
|
24
|
+
Provides-Extra: figures
|
|
25
|
+
Requires-Dist: matplotlib>=3.8; extra == "figures"
|
|
26
|
+
Provides-Extra: coword
|
|
27
|
+
Requires-Dist: nltk; extra == "coword"
|
|
28
|
+
Requires-Dist: spacy>=3.7; extra == "coword"
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: pytest; extra == "test"
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# CoordinationZ
|
|
34
|
+
|
|
35
|
+
CoordinationZ estimates whether two accounts' shared activity is unusual given how active the accounts are and how often each item is shared. The package contains the activity-conditioned null model. The repository also provides the scripts for reproducing the figures in *A null model to detect coordinated online behavior integrating evidence from multiple indicators*. [Preprint](https://doi.org/10.48550/arXiv.2610.17533)
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
python -m pip install coordinationz
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Wheels are built for CPython 3.10–3.12 on Linux x86-64, macOS (Apple Silicon and Intel), and Windows x86-64. Building from source requires a C compiler and, on Linux, OpenMP. The macOS and Windows wheels run the streaming sampler serially. Use version 0.3.0 for the code described here.
|
|
44
|
+
|
|
45
|
+
## Run a small example
|
|
46
|
+
|
|
47
|
+
Each tuple represents one occurrence. Keep repeated account–item tuples to preserve counts.
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from coordinationz.nullmodel import bipartiteNullModelSimilarity
|
|
51
|
+
|
|
52
|
+
occurrences = [
|
|
53
|
+
("a", "post-1"), ("a", "post-2"), ("a", "post-2"),
|
|
54
|
+
("b", "post-1"), ("b", "post-2"), ("c", "post-3"),
|
|
55
|
+
]
|
|
56
|
+
result = bipartiteNullModelSimilarity(
|
|
57
|
+
occurrences,
|
|
58
|
+
backend="c_streaming",
|
|
59
|
+
idf="smoothlog",
|
|
60
|
+
realizations=10_000,
|
|
61
|
+
workers=2,
|
|
62
|
+
seed=9999,
|
|
63
|
+
showProgress=False,
|
|
64
|
+
)
|
|
65
|
+
for (i, j), similarity, p in zip(
|
|
66
|
+
result["indexedEdges"], result["similarities"], result["pvalues"]
|
|
67
|
+
):
|
|
68
|
+
print(result["labels"][i], result["labels"][j], similarity, p)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The output contains pairs with positive observed similarity. A missing indicator contributes a value of one in the ranking pipeline. Combined pair and account scores are ranking statistics. See the replication guide for the filters and scoring rules.
|
|
72
|
+
|
|
73
|
+
## Reproduce the figures
|
|
74
|
+
|
|
75
|
+
From a Git checkout, install the plotting dependencies and run the figure scripts:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
python -m pip install '.[figures]'
|
|
79
|
+
python reproduction/figures/make_all.py
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This writes vector PDFs and SVGs to `reproduction/rendered/` using the bundled aggregate figure inputs. See the [replication guide](docs/replication.md) for the figure index, raw benchmark workflow, optional co-word analysis, and verification commands. The historical INCAS and community workflows are available in the [0.2.2 source](https://github.com/osome-iu/coordinationz/tree/v0.2.2). See [release instructions](docs/releasing.md) for PyPI publishing.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# CoordinationZ
|
|
2
|
+
|
|
3
|
+
CoordinationZ estimates whether two accounts' shared activity is unusual given how active the accounts are and how often each item is shared. The package contains the activity-conditioned null model. The repository also provides the scripts for reproducing the figures in *A null model to detect coordinated online behavior integrating evidence from multiple indicators*. [Preprint](https://doi.org/10.48550/arXiv.2610.17533)
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python -m pip install coordinationz
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Wheels are built for CPython 3.10–3.12 on Linux x86-64, macOS (Apple Silicon and Intel), and Windows x86-64. Building from source requires a C compiler and, on Linux, OpenMP. The macOS and Windows wheels run the streaming sampler serially. Use version 0.3.0 for the code described here.
|
|
12
|
+
|
|
13
|
+
## Run a small example
|
|
14
|
+
|
|
15
|
+
Each tuple represents one occurrence. Keep repeated account–item tuples to preserve counts.
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from coordinationz.nullmodel import bipartiteNullModelSimilarity
|
|
19
|
+
|
|
20
|
+
occurrences = [
|
|
21
|
+
("a", "post-1"), ("a", "post-2"), ("a", "post-2"),
|
|
22
|
+
("b", "post-1"), ("b", "post-2"), ("c", "post-3"),
|
|
23
|
+
]
|
|
24
|
+
result = bipartiteNullModelSimilarity(
|
|
25
|
+
occurrences,
|
|
26
|
+
backend="c_streaming",
|
|
27
|
+
idf="smoothlog",
|
|
28
|
+
realizations=10_000,
|
|
29
|
+
workers=2,
|
|
30
|
+
seed=9999,
|
|
31
|
+
showProgress=False,
|
|
32
|
+
)
|
|
33
|
+
for (i, j), similarity, p in zip(
|
|
34
|
+
result["indexedEdges"], result["similarities"], result["pvalues"]
|
|
35
|
+
):
|
|
36
|
+
print(result["labels"][i], result["labels"][j], similarity, p)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The output contains pairs with positive observed similarity. A missing indicator contributes a value of one in the ranking pipeline. Combined pair and account scores are ranking statistics. See the replication guide for the filters and scoring rules.
|
|
40
|
+
|
|
41
|
+
## Reproduce the figures
|
|
42
|
+
|
|
43
|
+
From a Git checkout, install the plotting dependencies and run the figure scripts:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
python -m pip install '.[figures]'
|
|
47
|
+
python reproduction/figures/make_all.py
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This writes vector PDFs and SVGs to `reproduction/rendered/` using the bundled aggregate figure inputs. See the [replication guide](docs/replication.md) for the figure index, raw benchmark workflow, optional co-word analysis, and verification commands. The historical INCAS and community workflows are available in the [0.2.2 source](https://github.com/osome-iu/coordinationz/tree/v0.2.2). See [release instructions](docs/releasing.md) for PyPI publishing.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[paths]
|
|
2
|
+
IO_DATASETS = "Data/IO"
|
|
3
|
+
PREPROCESSED_DATASETS = "Data/Preprocessed"
|
|
4
|
+
NETWORKS = "Outputs/Networks"
|
|
5
|
+
TABLES = "Outputs/Tables"
|
|
6
|
+
CONFIGS = "Outputs/Configs"
|
|
7
|
+
|
|
8
|
+
[indicator]
|
|
9
|
+
minUserActivities = 10
|
|
10
|
+
minUserDegree = 10
|
|
11
|
+
minUserStrength = 1
|
|
12
|
+
minItemDegree = 10
|
|
13
|
+
minItemStrength = 1
|
|
14
|
+
|
|
15
|
+
[nullmodel]
|
|
16
|
+
backend = "c_streaming"
|
|
17
|
+
scoreType = ["pvalue"]
|
|
18
|
+
realizations = 100000
|
|
19
|
+
repetitionCount = 2
|
|
20
|
+
IDFWeightsRealizations = 100
|
|
21
|
+
idf = "smoothlog"
|
|
22
|
+
workers = 64
|
|
23
|
+
seed = 9999
|
|
24
|
+
minSimilarity = 0.0
|
|
25
|
+
pvalueScreenThreshold = 1.0
|
|
26
|
+
|
|
27
|
+
[network]
|
|
28
|
+
similarityThreshold = 0.0
|
|
29
|
+
pvalueThreshold = 1.0
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Releasing CoordinationZ
|
|
2
|
+
|
|
3
|
+
Update the version in `meson.build` and `source/coordinationz/__init__.py` together. From a committed checkout, install `build` and `twine`, then run:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
python -m build
|
|
7
|
+
python -m twine check --strict dist/*
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Use a clean environment to install the built wheel and run `python -m pytest -q` and `python reproduction/check_null_model.py --exact-only`. CI also installs from the source distribution and tests the repaired wheels on each supported platform.
|
|
11
|
+
|
|
12
|
+
After CI passes on the release commit, push the matching `vX.Y.Z` tag to `osome-iu/coordinationz`. The release job validates the tag against the built files and sends the tested artifacts to PyPI using OpenID Connect. The `coordinationz` PyPI project must trust owner `osome-iu`, repository `coordinationz`, and workflow `build-publish-pypi.yml`, with the environment field empty. Check this setting after a repository transfer. [PyPI publisher settings](https://pypi.org/manage/project/coordinationz/settings/publishing/)
|
|
13
|
+
|
|
14
|
+
Verify the new version from a clean virtual environment after the workflow finishes:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
python -m pip install --no-cache-dir coordinationz==X.Y.Z
|
|
18
|
+
python -c "from coordinationz import __version__, fastcosine; print(__version__, fastcosine.nullModelPValuesStreaming.__name__)"
|
|
19
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Replicate the CoordinationZ analysis
|
|
2
|
+
|
|
3
|
+
## Figures
|
|
4
|
+
|
|
5
|
+
Install `.[figures]` and run `python reproduction/figures/make_all.py` from the repository root. Pass figure identifiers to render a subset, for example `python reproduction/figures/make_all.py 4 7 S3`. The script creates PDF, SVG, and PNG previews. Ghostscript is optional and adds outlined PDFs. Install Liberation Sans and Liberation Mono to match the figure layout.
|
|
6
|
+
|
|
7
|
+
| Figure | Script | Input |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| 1. Method overview | `fig_overview.py` | Toy examples |
|
|
10
|
+
| 2. Data, indicators, and filters | `fig_data.py` | Dataset count and survivor summaries |
|
|
11
|
+
| 3. Bipartite and similarity networks | `fig_similarity.py` | Toy examples |
|
|
12
|
+
| 4. Activity-conditioned similarity | `fig_nullmodel.py` | Anonymous null summaries and Cuba histograms |
|
|
13
|
+
| 5. Indicator and account aggregation | `fig_aggregation.py` | Toy examples and ranking rules |
|
|
14
|
+
| 6. Performance of the eight variants | `fig_variants.py` | Aggregate ROC AUC, AP, and precision at 100 |
|
|
15
|
+
| 7. Dataset-level performance | `fig_dataset_auc_main.py` | Per-dataset ROC AUC |
|
|
16
|
+
| 8. Threshold sensitivity | `fig_auc_thresholds.py` | Per-dataset ROC AUC at three cutoffs |
|
|
17
|
+
| Supplementary ROC AUC and AP heatmaps | `fig_supp.py` | Per-dataset ROC AUC and AP |
|
|
18
|
+
|
|
19
|
+
The scripts live in `reproduction/figures/`. The inputs in `reproduction/inputs/` are small aggregate summaries, with no account identifiers. They reproduce the values and plot structure of the supplied eight-figure revision. The snapshots derive from the saved June 2026 100,000-realization runs and the October evaluation. Request the original data through [Labeled Datasets for Research on Information Operations](https://doi.org/10.5281/zenodo.14141549).
|
|
20
|
+
|
|
21
|
+
## From benchmark inputs to rankings
|
|
22
|
+
|
|
23
|
+
1. Copy `config_paper.toml` to `config.local.toml` and set its paths. The original benchmark loader expects trusted gzip-compressed Pandas pickle files at `IO_DATASETS/{io,control}/DATASET_{io,control}.pkl.gz` or `IO_DATASETS/{io,control}/DATASET.pkl.gz`. The file stems used in the saved analysis are mapped to benchmark names in [benchmark_mapping.csv](../reproduction/inputs/benchmark_mapping.csv). If you already have a normalized CSV, put it in `PREPROCESSED_DATASETS`. Its columns include `user_id`, `tweet_type`, `linked_tweet`, `urls`, `hashtags`, `mentioned_users`, and optionally `category` and `text`. Keep IDs as strings and encode lists as Python or JSON string lists.
|
|
24
|
+
2. Normalize the benchmark and generate the three indicator networks:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python pipeline/preprocess/preprocessIO.py DATASET -c config.local.toml
|
|
28
|
+
python pipeline/indicators.py DATASET -c config.local.toml -s paper_nocoword
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For an anonymized campaign CSV from the benchmark deposit, use `python pipeline/preprocess/preprocessIO.py DATASET --input CAMPAIGN.csv.gz -c config.local.toml`. For Parquet, install `pyarrow` and pass the corresponding file. This adapter uses the fields available in the deposit. In particular, the published schema does not identify quotes separately.
|
|
32
|
+
|
|
33
|
+
The activity threshold is ten per account. Co-retweet counts retweets, co-URL counts posts with URLs, and co-hashtag counts posts with at least two hashtags. Co-hashtag and co-URL remove retweets before constructing edges. The bipartite filters retain items with at least ten distinct accounts, then accounts with at least ten remaining distinct items, in one pass.
|
|
34
|
+
3. Aggregate the saved networks. Use the configured network and table paths if they differ from the defaults:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
python pipeline/aggregate_indicator_variants.py \
|
|
38
|
+
--input-template 'Outputs/Networks/DATASET_paper_nocoword_{indicator}.xnet' \
|
|
39
|
+
--indicators coretweet cohashtag courl \
|
|
40
|
+
--nodes-csv Outputs/Tables/DATASET_paper_nocoword_filter_survivor_nodes.csv \
|
|
41
|
+
--name DATASET_nocoword --no-visual-xnet
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The production configuration uses 100 shuffled IDF realizations, two representatives per activity count, 100,000 sampled realizations, seed 9999, and 64 requested workers. Use a small synthetic dataset with lower filter thresholds and fewer draws for a smoke run. Python hash randomization and input ordering can change the account/item index mapping, so pin both when comparing repeated simulations. Account-level products are ranked in log space. Degree and eigenvector variants keep edges with combined values strictly below their respective thresholds.
|
|
45
|
+
|
|
46
|
+
## Evaluate and redraw
|
|
47
|
+
|
|
48
|
+
The paper evaluates the accounts that pass the filters for at least one of co-retweet, co-hashtag, and co-URL. It uses nine benchmark datasets, ROC AUC, average precision, and precision at 100. Accounts with conflicting labels are excluded from evaluation. The rank cutoff allocates ties by fractional expectation.
|
|
49
|
+
|
|
50
|
+
To rerun the evaluation with the saved outputs, point `COORDINATIONZ_DATA_ROOT` at the directory containing `Data/Preprocessed/` and `Outputs/Tables/`, and run `python reproduction/evaluate_null_aggregations.py`. The saved-output evaluation reads both three- and four-indicator summaries for the supplementary comparisons. To generate a matching four-indicator run, install `.[coword]`, run `python -m spacy download en_core_web_lg` and `python -m nltk.downloader stopwords`, then repeat the indicator command with `-s paper_all4 -i coretweet cohashtag courl coword`. Aggregate it using the four network names and the matching survivor CSV, with `--name DATASET_all4`.
|
|
51
|
+
|
|
52
|
+
Evaluation writes to `reproduction/results/` by default. Keep the resulting `accounts/` directory local. Run `python reproduction/prepare_figure_data.py` for the historical Cuba Figure 4 data, or pass `--prefix cuba_082020_tweets_paper_nocoword` with newly generated files. The script reads the corresponding filtered co-hashtag occurrence checkpoint. Use `--save-occurrences` on the indicators command to create it. Then point `COORDINATIONZ_FIGURE_INPUTS` at `reproduction/results/` to redraw using those results. Set `COORDINATIONZ_FIGURE_DIR` to change the render destination.
|
|
53
|
+
|
|
54
|
+
For implementation checks, run `python -m pytest -q`. Run `python reproduction/check_null_model.py --exact-only` to compare the C sampler against exact enumeration in both sampling regimes and verify results across thread counts. Omit `--exact-only` to also run the synthetic calibration and planted-group checks.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
project(
|
|
2
|
+
'coordinationz',
|
|
3
|
+
'c',
|
|
4
|
+
version: '0.3.0',
|
|
5
|
+
license: 'MIT',
|
|
6
|
+
default_options: ['c_std=c11', 'optimization=3', 'warning_level=3'],
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
host_system = host_machine.system()
|
|
10
|
+
if host_system == 'darwin'
|
|
11
|
+
add_project_arguments('-DOSX', '-DCV_USE_LIBDISPATCH=1', '-fblocks', language: 'c')
|
|
12
|
+
elif host_system == 'windows'
|
|
13
|
+
add_project_arguments('-DWIN32', '-D__WIN32__', language: 'c')
|
|
14
|
+
else
|
|
15
|
+
add_project_arguments('-DLinux', '-D_GNU_SOURCE=1', '-DCV_USE_OPENMP=1', language: 'c')
|
|
16
|
+
endif
|
|
17
|
+
|
|
18
|
+
subdir('source')
|