Skip to content

Commit dc280a6

Browse files
Krsto ProrokovićKrsto Proroković
authored andcommitted
Update tests
1 parent f16795d commit dc280a6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

test/scholar/linear/logistic_regression_test.exs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defmodule Scholar.Linear.LogisticRegressionTest do
1010
res = LogisticRegression.predict(model, x_test)
1111
accuracy = Scholar.Metrics.Classification.accuracy(res, y_test)
1212

13-
assert Nx.greater_equal(accuracy, 0.96) == Nx.u8(1)
13+
assert Nx.to_number(accuracy) >= 0.96
1414
end
1515

1616
describe "errors" do
@@ -84,7 +84,7 @@ defmodule Scholar.Linear.LogisticRegressionTest do
8484
assert_raise ArgumentError,
8585
"""
8686
expected y to have shape {num_samples}, \
87-
got tensor with shape: {2, 2}
87+
got tensor with shape: {2, 2}\
8888
""",
8989
fn -> LogisticRegression.fit(x, y, num_classes: 2) end
9090
end
@@ -116,7 +116,7 @@ defmodule Scholar.Linear.LogisticRegressionTest do
116116
model = LogisticRegression.fit(x, y, num_classes: 2)
117117
y_pred = LogisticRegression.predict(model, x)
118118
accuracy = Scholar.Metrics.Classification.accuracy(y, y_pred)
119-
assert Nx.equal(accuracy, 1)
119+
assert Nx.to_number(accuracy) == 1.0
120120
end
121121

122122
test "2D" do
@@ -130,7 +130,7 @@ defmodule Scholar.Linear.LogisticRegressionTest do
130130
model = LogisticRegression.fit(x, y, num_classes: 2)
131131
y_pred = LogisticRegression.predict(model, x)
132132
accuracy = Scholar.Metrics.Classification.accuracy(y, y_pred)
133-
assert Nx.equal(accuracy, 1)
133+
assert Nx.to_number(accuracy) == 1.0
134134
end
135135
end
136136
end

0 commit comments

Comments
 (0)