From d4c3988ea1a690dacab8c72365d8ced83ac8a511 Mon Sep 17 00:00:00 2001 From: Jeff Fessler Date: Sat, 29 Aug 2026 23:02:47 -0400 Subject: [PATCH] Use explicit imports Updated example to include specific imports for KNNClassifier and MLJBase functions. --- docs/src/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/src/index.md b/docs/src/index.md index 6f927b8..58c2551 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -31,13 +31,15 @@ performance evaluation, hyper-parameter tuning, stacking etc. The following example shows how to train a `KNNClassifier` on the crabs dataset. ```julia -using NearestNeighborModels, MLJBase +using NearestNeighborModels: KNNClassifier, Inverse +using MLJBase: @load_crabs, fit!, machine, nrows, partition, predict, predict_mode X, y = @load_crabs; # loads the crabs dataset from MLJBase train_inds, test_inds = partition(1:nrows(X), 0.7, shuffle=false); knnc = KNNClassifier(weights = Inverse()) # KNNClassifier instantiation knnc_mach = machine(knnc, X, y) # wrap model and required data in an MLJ machine fit!(knnc_mach, rows=train_inds) # train machine on a subset of the wrapped data `X` ``` + `UnivariateFinite` predictions can be obtained from the trained machine as shown below ```@meta DocTestSetup = quote