forked from cblearn/cblearn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add JOSS paper and improvements (cblearn#78)
* Create references.bib * Create paper.md * Create build-paper-pdf.yaml * add supplementaries * extend unit tests * extend documentation Co-authored-by: Mojtaba Barzegari <40744245+mbarzegary@users.noreply.github.com>
- Loading branch information
1 parent
79713a9
commit d5177e7
Showing
68 changed files
with
2,437 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Build paper | ||
|
||
on: | ||
push: | ||
paths: | ||
- paper/** | ||
|
||
jobs: | ||
paper: | ||
runs-on: ubuntu-latest | ||
name: Build Paper PDF | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Build draft PDF | ||
uses: openjournals/openjournals-draft-action@master | ||
with: | ||
journal: joss | ||
# This should be the path to the paper within your repo. | ||
paper-path: paper/paper.md | ||
- name: Build supplementary PDF | ||
uses: docker://pandoc/latex:2.9 | ||
with: | ||
args: >- # allows you to break string into multiple lines | ||
--standalone | ||
--output=paper/supplementary.pdf | ||
--bibliography=paper/references.bib | ||
--resource-path=paper/ | ||
paper/supplementary.md | ||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: paper-pdf | ||
# This is the output path where Pandoc will write the compiled | ||
# PDF. Note, this should be the same directory as the input | ||
# paper.md | ||
path: paper/*.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pytest | ||
import numpy as np | ||
|
||
from cblearn.datasets import triplet_response | ||
|
||
|
||
def test_triplet_response_validates_input(): | ||
n = 5 # n objects | ||
t = 10 # n triplets | ||
d = 2 # n dimensions | ||
valid_queries = [ | ||
np.random.choice(n, size=3, replace=False) | ||
for _ in range(t) | ||
] | ||
invalid_queries_1 = [ | ||
np.random.choice(n, size=5, replace=False) | ||
for _ in range(t) | ||
] | ||
invalid_queries_2 = [ | ||
np.random.choice(n + 1, size=3, replace=False) | ||
for _ in range(t) | ||
] | ||
invalid_queries_3 = np.random.uniform(low=-1, high=1, size=(t, 3)) | ||
embedding = np.random.normal(size=(n, d)) | ||
|
||
responses = triplet_response(valid_queries, embedding) | ||
assert responses.shape == (t, 3) | ||
with pytest.raises(ValueError): | ||
triplet_response(invalid_queries_1, embedding) | ||
with pytest.raises(ValueError): | ||
triplet_response(invalid_queries_2, embedding) | ||
with pytest.raises(ValueError): | ||
triplet_response(invalid_queries_3, embedding) |
Oops, something went wrong.