From 582b220b1c8f8b9762fa5fc5827d1d59ed380826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 15 May 2024 00:36:08 +0200 Subject: [PATCH] Add a test for custom metric on BruteKNN --- test/scholar/neighbors/brute_knn_test.exs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/scholar/neighbors/brute_knn_test.exs b/test/scholar/neighbors/brute_knn_test.exs index 052f02bb..1cac3d35 100644 --- a/test/scholar/neighbors/brute_knn_test.exs +++ b/test/scholar/neighbors/brute_knn_test.exs @@ -119,5 +119,10 @@ defmodule Scholar.Neighbors.BruteKNNTest do assert distances_pred == distances_true end + + test "custom metric" do + model = BruteKNN.fit(data(), num_neighbors: 3, batch_size: 1, metric: :cosine) + assert {_, _} = BruteKNN.predict(model, query()) + end end end