Skip to content

Commit

Permalink
Revert to interpolation arg
Browse files Browse the repository at this point in the history
  • Loading branch information
andreped committed Jan 8, 2025
1 parent 9d08768 commit 08881ed
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/test_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_cov():
def test_percentile():
x = np.random.randn(10, 10)
p = 20
p_np = np.percentile(x, p, method='nearest')
p_np = np.percentile(x, p, interpolation='nearest')
p_t = torchstain.tf.utils.percentile(x, p)

np.testing.assert_almost_equal(p_np, p_t)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_cov():
def test_percentile():
x = np.random.randn(10, 10)
p = 20
p_np = np.percentile(x, p, method='nearest')
p_np = np.percentile(x, p, interpolation='nearest')
p_t = torchstain.torch.utils.percentile(torch.tensor(x), p)

np.testing.assert_almost_equal(p_np, p_t)
Expand Down
2 changes: 1 addition & 1 deletion torchstain/tf/utils/percentile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def percentile(t: tf.Tensor, q: float) -> Union[int, float]:
CAUTION:
* Values are not interpolated, which corresponds to
``numpy.percentile(..., method="nearest")``.
``numpy.percentile(..., interpolation="nearest")``.
:param t: Input tensor.
:param q: Percentile to compute, which must be between 0 and 100 inclusive.
Expand Down
2 changes: 1 addition & 1 deletion torchstain/torch/utils/percentile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def percentile(t: torch.Tensor, q: float) -> Union[int, float]:
CAUTION:
* Needs PyTorch >= 1.1.0, as ``torch.kthvalue()`` is used.
* Values are not interpolated, which corresponds to
``numpy.percentile(..., method="nearest")``.
``numpy.percentile(..., interpolation="nearest")``.
:param t: Input tensor.
:param q: Percentile to compute, which must be between 0 and 100 inclusive.
Expand Down

0 comments on commit 08881ed

Please sign in to comment.