Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.3.1 #37

Merged
merged 13 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/python-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.9, "3.10", "3.11", "3.12", "3.13" ]

steps:
- uses: actions/checkout@v2
Expand All @@ -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: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

18 changes: 0 additions & 18 deletions Pipfile

This file was deleted.

17 changes: 17 additions & 0 deletions association_measures/comparisons.py
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions association_measures/resources/measures.tsv
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion association_measures/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
34 changes: 25 additions & 9 deletions makefile
Original file line number Diff line number Diff line change
@@ -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/
8 changes: 8 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-r requirements.txt
pytest==7.4.0
pylint==2.17.5
pytest-cov==4.1.0
wheel==0.45.1
twine==6.1.0
setuptools==75.8.2
cython==3.0.12
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pandas>=2.2.2,<3.0
numpy>=2.0,<3.0
scipy>=1.13.0,<2.0
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
EMAIL = '[email protected]'
AUTHOR = 'Philipp Heinrich & Markus Opolka'

REQUIRES_PYTHON = '>=3.8'
REQUIRES_PYTHON = '>=3.9'
REQUIRED = [
'wheel',
'pandas',
'scipy'
'pandas>=2.2.2,<3.0',
'numpy>=2.0,<3.0',
'scipy>=1.13.0,<2.0',
# 'rbo>=0.1.3,<0.2'
]

here = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -97,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',
],
)
13 changes: 13 additions & 0 deletions tests/test_nas.py
Original file line number Diff line number Diff line change
@@ -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']])
Loading