Skip to content

Commit

Permalink
Merge pull request #22 from fau-klue/v0.1.7
Browse files Browse the repository at this point in the history
V0.1.7
  • Loading branch information
ausgerechnet authored Nov 4, 2021
2 parents bdb3787 + c9b5e34 commit a186c29
Show file tree
Hide file tree
Showing 10 changed files with 6,892 additions and 409 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/python-build.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
name: build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: [push, pull_request, workflow_dispatch]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.8, 3.9 ]
python-version: [ 3.6, 3.7, 3.8, 3.9 ]

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ twine = "==3.4.2"

[packages]
pandas = "*"
scipy = "*"
505 changes: 294 additions & 211 deletions Pipfile.lock

Large diffs are not rendered by default.

59 changes: 29 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ http://www.collocations.de/AM/index.html

# Installation

**Prerequisites:** As of version v0.1.6, this module requires python version 3.8 or above.
**Prerequisites:**
- [pandas](https://pandas.pydata.org/)
- [scipy](https://scipy.org/) (as of version v0.1.7)

**Using pip:**
**Installation using pip:**

pip install association-measures

**From Source:**
**Installation from source (requires Cython):**

# Compile Cython code (requires Cython)
# Compile Cython code
python setup.py build_ext --inplace

# Cython already compiled
Expand Down Expand Up @@ -52,7 +54,7 @@ id
5 arrived 2 15334 5 191998
```

Combinations of both are possible, but you should make sure to include four independent values for each rows, and that all of the following equations hold:
Combinations of both are possible, but you should make sure to include four independent values, and that all of the following equations hold:

- f = O11
- f1 = O11 + O12
Expand Down Expand Up @@ -115,15 +117,21 @@ You can thus `join` the results directly to the input.

## Association Measures

As of version 0.1.6, the following association measures are supported:

- z-score
- t-score
- mutual information
- dice
- log-likelihood
- log-ratio
- conservative log-ratio
As of version 0.1.7, the following association measures are supported:

- asymptotic hypothesis tests:
- z-score (`z_score`)
- t-score (`t_score`)
- log-likelihood (`log_likelihood`)
- simple-ll (`simple_ll`)
- point estimates of association strength:
- log-ratio (`log_ratio`)
- Dice coefficient (`dice`)
- information theory:
- mutual information (`mutual_information`)
- local MI (`local_mutual_information`)
- conservative estimates:
- conservative log-ratio (`conservative_log_ratio`)

You can either calculate specific measures:

Expand All @@ -144,12 +152,13 @@ or calculate all available measures:
```python3
>>> df = am.calculate_measures(df)
>>> df_am.head()
z_score t_score dice log_likelihood mutual_information log_ratio conservative_log_ratio
appreciated 2.102442 0.840269 0.000130 2.448757 0.796611 3.526202 0.0
certain -0.834636 -0.976603 0.000906 -0.829802 -0.136442 -0.486622 0.0
measuring 0.451726 0.361077 0.000130 0.191806 0.194551 0.718847 0.0
particularly -0.905150 -1.240035 0.000260 -1.059386 -0.273427 -0.965651 0.0
arrived 2.533018 1.131847 0.000261 3.879126 0.699701 2.941240 0.0
z_score t_score log_likelihood simple_ll dice log_ratio mutual_information local_mutual_information conservative_log_ratio
item
appreciated 2.102442 0.840269 2.448757 1.987992 0.000130 3.526202 0.796611 0.796611 0.0
certain -0.834636 -0.976603 -0.829802 -0.769331 0.000906 -0.486622 -0.136442 -0.955094 0.0
measuring 0.451726 0.361077 0.191806 0.173788 0.000130 0.718847 0.194551 0.194551 0.0
particularly -0.905150 -1.240035 -1.059386 -0.988997 0.000260 -0.965651 -0.273427 -0.546853 0.0
arrived 2.533018 1.131847 3.879126 3.243141 0.000261 2.941240 0.699701 1.399402 0.0
```

# Development
Expand All @@ -172,13 +181,3 @@ make test
# Coverage
make coverage
```

## Publish in PyPI

```bash
make test && make compile

make build

pipenv run twine upload dist/<PATH-TO-NEW-VERSION>.tar.gz
```
Loading

0 comments on commit a186c29

Please sign in to comment.