From c35721988ed57a86a56cc6c3e5cbd1c550c0fcbf Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 5 Dec 2024 14:16:34 +0100 Subject: [PATCH 01/13] bump version --- association_measures/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/association_measures/version.py b/association_measures/version.py index bd4c933..598c70c 100644 --- a/association_measures/version.py +++ b/association_measures/version.py @@ -2,5 +2,5 @@ Association measures are mathematical formulae that interpret cooccurrence frequency data. """ -VERSION = (0, 3, 0) +VERSION = (0, 3, 1) __version__ = '.'.join(map(str, VERSION)) From d25d9d6a6dac459b2fd71fa8494b9e6bcb66ea2b Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 5 Dec 2024 14:17:41 +0100 Subject: [PATCH 02/13] add profile comparisons via RBO (WIP) --- Pipfile | 1 + association_measures/comparisons.py | 17 +++++++++++++++++ setup.py | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 association_measures/comparisons.py diff --git a/Pipfile b/Pipfile index 3267331..4a2fc70 100644 --- a/Pipfile +++ b/Pipfile @@ -16,3 +16,4 @@ wheel = ">=0.43.0,<0.44" pandas = ">=2.0,<3.0" numpy = ">=1.24,<2.0" scipy = ">=1.10.0" +rbo = ">=0.1.3,<0.2" diff --git a/association_measures/comparisons.py b/association_measures/comparisons.py new file mode 100644 index 0000000..05f72b8 --- /dev/null +++ b/association_measures/comparisons.py @@ -0,0 +1,17 @@ +""" +comparison of ranked lists + +""" + + +from rbo import RankingSimilarity + + +def compare_rbo(df1, df2, p): + + return RankingSimilarity(df1.index, df2.index).rbo(p=p) + + +def compare_gwets_ac1(df1, df2): + + pass diff --git a/setup.py b/setup.py index d3e449c..8dc8690 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,8 @@ REQUIRED = [ 'wheel', 'pandas', - 'scipy' + 'scipy', + 'rbo' ] here = os.path.abspath(os.path.dirname(__file__)) From ba496d46a630a2bcaa973ffe8bd21baa5c708644 Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 5 Dec 2024 14:20:56 +0100 Subject: [PATCH 03/13] add categorisation of measures as TSV file --- association_measures/resources/measures.tsv | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 association_measures/resources/measures.tsv diff --git a/association_measures/resources/measures.tsv b/association_measures/resources/measures.tsv new file mode 100644 index 0000000..a28812b --- /dev/null +++ b/association_measures/resources/measures.tsv @@ -0,0 +1,18 @@ +association_measures name abbreviation category +O11 observed frequency obs. raw +E11 expected frequency exp. raw +ipm observed instances per million obs. (ipm) raw +ipm_expected expected instances per million exp. (ipm) raw +conservative_log_ratio Conservative Log Ratio LRC conservative estimates +log_likelihood Log-Likelihood Ratio LLR asymptotic hypothesis tests +z_score z-score z-score asymptotic hypothesis tests +t_score t-score t-score asymptotic hypothesis tests +simple_LL simple Log-Likelihood Ratio simple LLR asymptotic hypothesis tests +dice Dice Dice point estimates of association strength +log_ratio Log Ratio LR point estimates of association strength +min_sensitivity Minimum Sensitivity MS point estimates of association strength +liddel Liddell Liddell point estimates of association strength +mutual_information Mutual Information MI information theory +local_mutual_information Local Mutual Information LMI information theory +hypergeometric_likelihood Hypergeometric Likelihood HL likelihood measures +binomial_likelihood Binomial Likelihood BL likelihood measures From 3c04543880e8d1d51819b2f0eef7dabf8f8c1c6f Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 5 Dec 2024 14:34:59 +0100 Subject: [PATCH 04/13] use venv instead pipenv for dependency management --- .github/workflows/python-build.yml | 1 - .github/workflows/python-publish.yml | 1 - Pipfile | 19 ---------------- makefile | 34 ++++++++++++++++++++-------- requirements-dev.txt | 8 +++++++ requirements.txt | 4 ++++ setup.py | 6 ++--- 7 files changed, 40 insertions(+), 33 deletions(-) delete mode 100644 Pipfile create mode 100644 requirements-dev.txt create mode 100644 requirements.txt diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index c77fd7f..c29b95f 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -19,7 +19,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install -q pipenv make install - name: Build run: | diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 4118803..186dde3 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -17,7 +17,6 @@ jobs: - name: Install build dependencies run: | python -m pip install --upgrade pip - python -m pip install -q pipenv make install - name: Build run: | diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 4a2fc70..0000000 --- a/Pipfile +++ /dev/null @@ -1,19 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] -pytest = "==7.4.0" -pylint = "==2.17.5" -pytest-cov = "==4.1.0" -twine = "==4.0.2" -setuptools = "==68.0.0" -cython = "==3.0.0" - -[packages] -wheel = ">=0.43.0,<0.44" -pandas = ">=2.0,<3.0" -numpy = ">=1.24,<2.0" -scipy = ">=1.10.0" -rbo = ">=0.1.3,<0.2" diff --git a/makefile b/makefile index 7deb16f..de73d17 100644 --- a/makefile +++ b/makefile @@ -1,18 +1,34 @@ .PHONY: performance test lint coverage build install: - pipenv install --dev -performance: - pipenv run python3 performance.py -test: - pipenv run pytest -v + python3 -m venv venv && \ + . venv/bin/activate && \ + pip3 install -U pip setuptools wheel && \ + pip3 install -r requirements-dev.txt + lint: - pipenv run pylint --rcfile=.pylintrc association_measures/*.py + . venv/bin/activate && \ + pylint --rcfile=.pylintrc association_measures/*.py + +test: + . venv/bin/activate && \ + pytest -s -v + +performance: + . venv/bin/activate && \ + python3 performance.py + coverage: - pipenv run pytest --cov-report term-missing -v --cov=association_measures/ + . venv/bin/activate && \ + pytest --cov-report term-missing -v --cov=association_measures/ + compile: - pipenv run python3 setup.py build_ext --inplace + . venv/bin/activate && \ + python3 setup.py build_ext --inplace + build: - pipenv run python3 setup.py sdist + . venv/bin/activate && \ + python3 setup.py sdist + clean: rm -rf *.egg-info build/ association_measures/*.so association_measures/*.c dist/ diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..640d2a1 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,8 @@ +-r requirements.txt +pytest==7.4.0 +pylint==2.17.5 +pytest-cov==4.1.0 +twine==4.0.2 +setuptools==68.0.0 +cython==3.0.0 +wheel diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0ce9e9a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +pandas>=2.0,<3.0 +numpy>=1.24.0,<2.0 +scipy>=1.10.0,<2.0 +rbo>=0.1.3,<0.2 diff --git a/setup.py b/setup.py index 8dc8690..0d544e1 100644 --- a/setup.py +++ b/setup.py @@ -14,9 +14,9 @@ REQUIRES_PYTHON = '>=3.8' REQUIRED = [ 'wheel', - 'pandas', - 'scipy', - 'rbo' + 'pandas>=2.0,<3.0', + 'scipy>=1.10.0,<2.0', + 'rbo>=0.1.3,<0.2' ] here = os.path.abspath(os.path.dirname(__file__)) From 8ff2b96b366767a2d611e845487e0d83adf3b1fb Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 5 Dec 2024 14:49:04 +0100 Subject: [PATCH 05/13] add test for checking NAs (WIP) --- tests/test_nas.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/test_nas.py diff --git a/tests/test_nas.py b/tests/test_nas.py new file mode 100644 index 0000000..787784b --- /dev/null +++ b/tests/test_nas.py @@ -0,0 +1,13 @@ +import association_measures.measures as am +from pandas import DataFrame + + +def test_nas(): + + d = DataFrame(data={'O11': 0, 'O12': 10, 'O21': 10, 'O22': 100}, index=['test']) + scores = am.score(d) + print(scores[['mutual_information', 'local_mutual_information']]) + + d = DataFrame(data={'O11': 0, 'O12': 10, 'O21': 0, 'O22': 100}, index=['test']) + scores = am.score(d) + print(scores[['ipm', 'ipm_expected']]) From 725affbeb94ee973e71bda56016ab0f61792f613 Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 27 Feb 2025 13:28:20 +0100 Subject: [PATCH 06/13] include Python 3.13 --- .github/workflows/python-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index c29b95f..fcecf5c 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ 3.8, 3.9, "3.10", "3.11", "3.12" ] + python-version: [ 3.8, 3.9, "3.10", "3.11", "3.12", "3.13" ] steps: - uses: actions/checkout@v2 From 7c96c3f5fed9899039dfe8dd956ba925228f5235 Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 27 Feb 2025 13:40:20 +0100 Subject: [PATCH 07/13] update dependencies --- requirements-dev.txt | 8 ++++---- requirements.txt | 2 +- setup.py | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 640d2a1..d883269 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,7 +2,7 @@ pytest==7.4.0 pylint==2.17.5 pytest-cov==4.1.0 -twine==4.0.2 -setuptools==68.0.0 -cython==3.0.0 -wheel +wheel==0.45.1 +twine==6.1.0 +setuptools==75.8.2 +cython==3.0.12 diff --git a/requirements.txt b/requirements.txt index 0ce9e9a..e2ca3cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ pandas>=2.0,<3.0 -numpy>=1.24.0,<2.0 +numpy>=2.0,3.0 scipy>=1.10.0,<2.0 rbo>=0.1.3,<0.2 diff --git a/setup.py b/setup.py index 0d544e1..388ce3e 100644 --- a/setup.py +++ b/setup.py @@ -11,10 +11,11 @@ EMAIL = 'philipp.heinrich@fau.de' AUTHOR = 'Philipp Heinrich & Markus Opolka' -REQUIRES_PYTHON = '>=3.8' +REQUIRES_PYTHON = '>=3.9' REQUIRED = [ 'wheel', 'pandas>=2.0,<3.0', + 'numpy>=2.0,<3.0', 'scipy>=1.10.0,<2.0', 'rbo>=0.1.3,<0.2' ] @@ -98,11 +99,11 @@ def run(self): 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'Programming Language :: Cython', ], ) From 0b6c54152f3d91912ca9c559c45c1427067e5686 Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 27 Feb 2025 13:43:30 +0100 Subject: [PATCH 08/13] fix typo --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e2ca3cb..38386e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ pandas>=2.0,<3.0 -numpy>=2.0,3.0 +numpy>=2.0,<3.0 scipy>=1.10.0,<2.0 rbo>=0.1.3,<0.2 From 7ab70ada9bffe81bdca9fe8402f1c89a3245b3a4 Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 27 Feb 2025 13:54:13 +0100 Subject: [PATCH 09/13] update req --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 38386e9..87514fa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pandas>=2.0,<3.0 +pandas>=2.2,2,<3.0 numpy>=2.0,<3.0 -scipy>=1.10.0,<2.0 +scipy>=1.13.0,<2.0 rbo>=0.1.3,<0.2 From 945efa93cc4f1708e099c75e27ec88dd5f6eefb5 Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 27 Feb 2025 14:02:31 +0100 Subject: [PATCH 10/13] fix typo --- requirements.txt | 2 +- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 87514fa..50cc4d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pandas>=2.2,2,<3.0 +pandas>=2.2.2,<3.0 numpy>=2.0,<3.0 scipy>=1.13.0,<2.0 rbo>=0.1.3,<0.2 diff --git a/setup.py b/setup.py index 388ce3e..2d85c8f 100644 --- a/setup.py +++ b/setup.py @@ -14,9 +14,9 @@ REQUIRES_PYTHON = '>=3.9' REQUIRED = [ 'wheel', - 'pandas>=2.0,<3.0', + 'pandas>=2.2.2,<3.0', 'numpy>=2.0,<3.0', - 'scipy>=1.10.0,<2.0', + 'scipy>=1.13.0,<2.0', 'rbo>=0.1.3,<0.2' ] From 0b346ea802a11a440a7e2646be26397bbc3c42f6 Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 27 Feb 2025 14:04:40 +0100 Subject: [PATCH 11/13] rm rbo req --- association_measures/comparisons.py | 10 +++++----- requirements.txt | 1 - setup.py | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/association_measures/comparisons.py b/association_measures/comparisons.py index 05f72b8..d4760d2 100644 --- a/association_measures/comparisons.py +++ b/association_measures/comparisons.py @@ -4,14 +4,14 @@ """ -from rbo import RankingSimilarity +# from rbo import RankingSimilarity -def compare_rbo(df1, df2, p): +# def compare_rbo(df1, df2, p): - return RankingSimilarity(df1.index, df2.index).rbo(p=p) +# return RankingSimilarity(df1.index, df2.index).rbo(p=p) -def compare_gwets_ac1(df1, df2): +# def compare_gwets_ac1(df1, df2): - pass +# pass diff --git a/requirements.txt b/requirements.txt index 50cc4d3..c92b03d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ pandas>=2.2.2,<3.0 numpy>=2.0,<3.0 scipy>=1.13.0,<2.0 -rbo>=0.1.3,<0.2 diff --git a/setup.py b/setup.py index 2d85c8f..fe7efb7 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ 'pandas>=2.2.2,<3.0', 'numpy>=2.0,<3.0', 'scipy>=1.13.0,<2.0', - 'rbo>=0.1.3,<0.2' + # 'rbo>=0.1.3,<0.2' ] here = os.path.abspath(os.path.dirname(__file__)) From d26b7da14b1e6e76e253c01e4c79626a80bdc3ca Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Thu, 27 Feb 2025 14:06:11 +0100 Subject: [PATCH 12/13] rm Python3.8 --- .github/workflows/python-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index fcecf5c..eeb48e0 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ 3.8, 3.9, "3.10", "3.11", "3.12", "3.13" ] + python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13" ] steps: - uses: actions/checkout@v2 From c73950b74e4f673b24abdb3d080269ba645d8630 Mon Sep 17 00:00:00 2001 From: Philipp Heinrich Date: Fri, 28 Feb 2025 12:59:40 +0100 Subject: [PATCH 13/13] rm obsolete travis.yml --- .travis.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8152d9b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -dist: xenial -language: python -script: - - 'make $TEST' -install: - - pip3 install -q pipenv - - make install - - make compile -matrix: - fast_finish: true - allow_failures: - - env: TEST='test' - python: 'nightly' - include: - - env: TEST='lint' - python: '3.7' - - env: TEST='coverage' - python: '3.7' - - env: TEST='test' - python: '3.7' - - env: TEST='test' - python: '3.8' - - env: TEST='test' - python: '3.9' - - env: TEST='test' - python: 'nightly' -after_success: coveralls