Skip to content

Commit

Permalink
Update lib/scholar/metrics/ranking.ex
Browse files Browse the repository at this point in the history
Co-authored-by: Mateusz Sluszniak <56299341+msluszniak@users.noreply.github.com>
  • Loading branch information
norm4nn and msluszniak authored Apr 7, 2024
1 parent ea54261 commit 5af66dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/scholar/metrics/ranking.ex
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ defmodule Scholar.Metrics.Ranking do
iex> true_relevance = Nx.tensor([10, 0, 0, 1, 5])
iex> scores = Nx.tensor([0.1, 0.2, 0.3, 4, 70])
iex> Scholar.Metrics.Ranking.ndcg_n(true_relevance, scores, [])
iex> Scholar.Metrics.Ranking.ndcg_n(true_relevance, scores)
#Nx.Tensor<
f32
0.6956940293312073
>
iex> scores = Nx.tensor([0.05, 1.1, 1.0, 0.5, 0.0])
iex> Scholar.Metrics.Ranking.ndcg_n(true_relevance, scores, [])
iex> Scholar.Metrics.Ranking.ndcg_n(true_relevance, scores)
#Nx.Tensor<
f32
0.4936802089214325
Expand All @@ -129,7 +129,7 @@ defmodule Scholar.Metrics.Ranking do
1.0
>
"""
defn ndcg_n(y_true, y_score, opts) do
defn ndcg_n(y_true, y_score, opts \\ []) do
dcg_n(y_true, y_score, opts) / dcg_n(y_true, y_true, opts)
end
end

0 comments on commit 5af66dc

Please sign in to comment.