Skip to content

Commit

Permalink
Update CI (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim authored Jan 15, 2025
1 parent 227858f commit 37197dd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
fail-fast: false
matrix:
include:
- elixir: "1.15.6"
otp: "26.1"
- elixir: "1.18.1"
otp: "27.1"
lint: true
- elixir: "1.14.5"
- elixir: "1.15.8"
otp: "26.1"
steps:
- uses: actions/checkout@v2
Expand Down
26 changes: 24 additions & 2 deletions test/scholar/neighbors/knn_regressor_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,18 @@ defmodule Scholar.Neighbors.KNNRegressorTest do

test "predict with 2D labels" do
y =
Nx.tensor([[1, 4], [0, 3], [2, 5], [0, 3], [0, 3], [1, 4], [2, 5], [0, 3], [1, 4], [2, 5]])
Nx.tensor([
[1, 4],
[0, 3],
[2, 5],
[0, 3],
[0, 3],
[1, 4],
[2, 5],
[0, 3],
[1, 4],
[2, 5]
])

model = KNNRegressor.fit(x_train(), y, num_neighbors: 3)
y_pred = KNNRegressor.predict(model, x())
Expand All @@ -111,7 +122,18 @@ defmodule Scholar.Neighbors.KNNRegressorTest do

test "predict with 2D labels, cosine metric and weights set to :distance" do
y =
Nx.tensor([[1, 4], [0, 3], [2, 5], [0, 3], [0, 3], [1, 4], [2, 5], [0, 3], [1, 4], [2, 5]])
Nx.tensor([
[1, 4],
[0, 3],
[2, 5],
[0, 3],
[0, 3],
[1, 4],
[2, 5],
[0, 3],
[1, 4],
[2, 5]
])

model =
KNNRegressor.fit(x_train(), y, num_neighbors: 3, metric: :cosine, weights: :distance)
Expand Down
13 changes: 12 additions & 1 deletion test/scholar/neighbors/rnn_regressor_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,18 @@ defmodule Scholar.Neighbors.RadiusNNRegressorTest do

test "predict with weights set to :distance and with specific metric and 2d labels" do
y =
Nx.tensor([[1, 4], [0, 3], [2, 5], [0, 3], [0, 3], [1, 4], [2, 5], [0, 3], [1, 4], [2, 5]])
Nx.tensor([
[1, 4],
[0, 3],
[2, 5],
[0, 3],
[0, 3],
[1, 4],
[2, 5],
[0, 3],
[1, 4],
[2, 5]
])

model =
RadiusNNRegressor.fit(x(), y,
Expand Down

0 comments on commit 37197dd

Please sign in to comment.