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

Use (inv)logcdf in tests + update CI #12

Merged
merged 7 commits into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: '3.9'
architecture: ${{ matrix.arch }}
# Limitation of pip: https://pythonot.github.io/index.html#pip-installation
- run: python -m pip install cython numpy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: '3.9'
architecture: ${{ matrix.arch }}
# Limitation of pip: https://pythonot.github.io/index.html#pip-installation
- run: python -m pip install cython numpy
Expand Down
4 changes: 2 additions & 2 deletions test/exact.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Random.seed!(100)
# compute OT plan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps try using ν = Normal(randn(), rand()+1) and the same for mu.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, let's try it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work 🎉

γ = ot_plan(sqeuclidean, μ, ν)
x = randn()
@test γ(x) ≈ quantile(ν, cdf(μ, x))
@test γ(x) ≈ invlogcdf(ν, logcdf(μ, x))

# compute OT cost
c = ot_cost(sqeuclidean, μ, ν)
Expand All @@ -91,7 +91,7 @@ Random.seed!(100)
# compute OT plan
γ = ot_plan(euclidean, μ, ν)
x = randn()
@test γ(x) ≈ quantile(ν, cdf(μ, x))
@test γ(x) ≈ invlogcdf(ν, logcdf(μ, x))

# compute OT cost, without and with provided plan
# do not use ν in the second case to ensure that the provided plan is used
Expand Down