Skip to content

Commit

Permalink
Simplify :type argument
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jul 16, 2023
1 parent 687e3a0 commit 3541041
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions lib/scholar/metrics.ex
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ defmodule Scholar.Metrics do
f32
0.6666666865348816
>
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: {:u, 32})
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: {:u, 32})
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: :u32)
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: :u32)
iex> Scholar.Metrics.accuracy(y_true, y_pred)
#Nx.Tensor<
f32
Expand Down Expand Up @@ -187,8 +187,8 @@ defmodule Scholar.Metrics do
## Examples
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: {:u, 32})
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: {:u, 32})
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: :u32)
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: :u32)
iex> Scholar.Metrics.precision(y_true, y_pred, num_classes: 3)
#Nx.Tensor<
f32[3]
Expand Down Expand Up @@ -246,8 +246,8 @@ defmodule Scholar.Metrics do
## Examples
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: {:u, 32})
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: {:u, 32})
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: :u32)
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: :u32)
iex> Scholar.Metrics.recall(y_true, y_pred, num_classes: 3)
#Nx.Tensor<
f32[3]
Expand Down Expand Up @@ -315,8 +315,8 @@ defmodule Scholar.Metrics do
## Examples
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: {:u, 32})
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: {:u, 32})
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: :u32)
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: :u32)
iex> Scholar.Metrics.sensitivity(y_true, y_pred, num_classes: 3)
#Nx.Tensor<
f32[3]
Expand Down Expand Up @@ -369,8 +369,8 @@ defmodule Scholar.Metrics do
## Examples
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: {:u, 32})
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: {:u, 32})
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: :u32)
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: :u32)
iex> Scholar.Metrics.specificity(y_true, y_pred, num_classes: 3)
#Nx.Tensor<
f32[3]
Expand Down Expand Up @@ -403,8 +403,8 @@ defmodule Scholar.Metrics do
## Examples
iex> y_true = Nx.tensor([0, 0, 1, 1, 2, 2], type: {:u, 32})
iex> y_pred = Nx.tensor([0, 1, 0, 2, 2, 2], type: {:u, 32})
iex> y_true = Nx.tensor([0, 0, 1, 1, 2, 2], type: :u32)
iex> y_pred = Nx.tensor([0, 1, 0, 2, 2, 2], type: :u32)
iex> Scholar.Metrics.confusion_matrix(y_true, y_pred, num_classes: 3)
#Nx.Tensor<
u64[3][3]
Expand Down Expand Up @@ -533,8 +533,8 @@ defmodule Scholar.Metrics do
## Examples
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: {:u, 32})
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: {:u, 32})
iex> y_true = Nx.tensor([0, 1, 1, 1, 1, 0, 2, 1, 0, 1], type: :u32)
iex> y_pred = Nx.tensor([0, 2, 1, 1, 2, 2, 2, 0, 0, 1], type: :u32)
iex> Scholar.Metrics.f1_score(y_true, y_pred, num_classes: 3)
#Nx.Tensor<
f32[3]
Expand Down Expand Up @@ -609,8 +609,8 @@ defmodule Scholar.Metrics do
## Examples
iex> y_true = Nx.tensor([[0.0, 1.0], [0.0, 0.0]], type: {:f, 32})
iex> y_pred = Nx.tensor([[1.0, 1.0], [1.0, 0.0]], type: {:f, 32})
iex> y_true = Nx.tensor([[0.0, 1.0], [0.0, 0.0]])
iex> y_pred = Nx.tensor([[1.0, 1.0], [1.0, 0.0]])
iex> Scholar.Metrics.mean_absolute_error(y_true, y_pred)
#Nx.Tensor<
f32
Expand All @@ -633,8 +633,8 @@ defmodule Scholar.Metrics do
## Examples
iex> y_true = Nx.tensor([[0.0, 2.0], [0.5, 0.0]], type: {:f, 32})
iex> y_pred = Nx.tensor([[1.0, 1.0], [1.0, 0.0]], type: {:f, 32})
iex> y_true = Nx.tensor([[0.0, 2.0], [0.5, 0.0]])
iex> y_pred = Nx.tensor([[1.0, 1.0], [1.0, 0.0]])
iex> Scholar.Metrics.mean_square_error(y_true, y_pred)
#Nx.Tensor<
f32
Expand Down

0 comments on commit 3541041

Please sign in to comment.