Skip to content

Commit

Permalink
comments and ci testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mg98 committed Nov 1, 2023
1 parent a8a59c5 commit 58ac638
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Run Tests

on: [push, pull_request]

jobs:
test:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.11]

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
python -m unittest discover -s tests -p '*test*.py'
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Model is stored in memory; you restart the app, you start from scratch.

### Advanced Options

- Use `-k <int>` to specify the number of relevant top-k results used for ranking.

- Use `-q` to enable quantization of the model.
In our experiments, this yielded a data reduction of 4x when transferring the model,
however, at the cost of performance speed and accuracy.
Expand Down
2 changes: 1 addition & 1 deletion p2p_ol2r/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def ndcg(expected: list[str], actual: list[str], form="linear"):
if form == "linear":
idcg = np.sum(rel_true[:p] * discount)
dcg = np.sum(rel_pred[:p] * discount)
elif form == "exponential" or form == "exp":
elif form == "exp":
idcg = np.sum([2**x - 1 for x in rel_true[:p]] * discount)
dcg = np.sum([2**x - 1 for x in rel_pred[:p]] * discount)
else:
Expand Down

0 comments on commit 58ac638

Please sign in to comment.