From 25498f502a1793e1a7b5b2f20c4754dbf1b06e70 Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 1 Jun 2026 00:00:01 +0800 Subject: [PATCH 1/7] modify fnn params --- R/fnn.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/fnn.R b/R/fnn.R index 005f4d9..765abff 100644 --- a/R/fnn.R +++ b/R/fnn.R @@ -1,4 +1,4 @@ -.fnn_ts = \(data, target, E = 2:10, k = 1, tau = 1, style = 1, lib = NULL, pred = NULL, +.fnn_ts = \(data, target, E = 10, k = 1, tau = 1, style = 1, lib = NULL, pred = NULL, dist.metric = c("euclidean", "manhattan", "maximum"), rt = 10, eps = NULL, threads = length(E), higher.parallel = TRUE, ...) { dist.metric = match.arg(dist.metric) @@ -11,7 +11,7 @@ k, threads, higher.parallel, NULL, NULL)) } -.fnn_lattice = \(data, target, E = 3:10, k = 1, tau = 1, style = 1, lib = NULL, pred = NULL, +.fnn_lattice = \(data, target, E = 10, k = 1, tau = 1, style = 1, lib = NULL, pred = NULL, dist.metric = c("euclidean", "manhattan", "maximum"), rt = 10, eps = NULL, threads = length(E), higher.parallel = TRUE, detrend = FALSE, nb = NULL, ...) { if (is.null(nb)) nb = sdsfun::spdep_nb(data) @@ -25,7 +25,7 @@ k, threads, higher.parallel, nb, NULL)) } -.fnn_grid = \(data, target, E = 3:10, k = 1, tau = 1, style = 1, lib = NULL, pred = NULL, +.fnn_grid = \(data, target, E = 10, k = 1, tau = 1, style = 1, lib = NULL, pred = NULL, dist.metric = c("euclidean", "manhattan", "maximum"), rt = 10, eps = NULL, threads = length(E), higher.parallel = TRUE, detrend = FALSE, ...) { dist.metric = match.arg(dist.metric) From b3196862dbec3fc95458af56a5f137301d5ef2cd Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 1 Jun 2026 00:00:01 +0800 Subject: [PATCH 2/7] clarify output indexing and boundary handling in fnn --- src/FNN.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/FNN.cpp b/src/FNN.cpp index e033f06..18f8707 100644 --- a/src/FNN.cpp +++ b/src/FNN.cpp @@ -261,9 +261,10 @@ Rcpp::NumericVector RcppFNN( result.names() = resnames; // Terminal-friendly hint (one-time, non-intrusive) - Rcpp::Rcout << "[fnn] Output 'E:i' corresponds to the i-th valid embedding dimension.\n" + Rcpp::Rcout << "[fnn] Max embedding dimension E is auto-computed; input values < 2 are forced to 2.\n" << "[fnn] Input E values exceeding max embeddable dimension were truncated.\n" - << "[fnn] Please map output indices to original E inputs before interpretation.\n"; + << "[fnn] Results are returned for embedding dimensions 1 through E.\n" + << "[fnn] Output 'E:i' (where i = 1 to E-1) corresponds to the comparison between dimension i and i+1.\n"; return result; } From e248fccb1bd95a4b158d0dc36d95ae7745ac3f2d Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 1 Jun 2026 00:00:01 +0800 Subject: [PATCH 3/7] clarify output indexing and boundary handling in fnn --- src/FNN.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FNN.cpp b/src/FNN.cpp index 18f8707..8cce8ee 100644 --- a/src/FNN.cpp +++ b/src/FNN.cpp @@ -261,10 +261,10 @@ Rcpp::NumericVector RcppFNN( result.names() = resnames; // Terminal-friendly hint (one-time, non-intrusive) - Rcpp::Rcout << "[fnn] Max embedding dimension E is auto-computed; input values < 2 are forced to 2.\n" - << "[fnn] Input E values exceeding max embeddable dimension were truncated.\n" - << "[fnn] Results are returned for embedding dimensions 1 through E.\n" - << "[fnn] Output 'E:i' (where i = 1 to E-1) corresponds to the comparison between dimension i and i+1.\n"; + Rcpp::Rcout << "[fnn] Input E values exceeding max embeddable dimension were truncated.\n" + << "[fnn] Max embedding dimension E_max is auto-computed; E_max < 2 are forced to 2.\n" + << "[fnn] Results are returned for embedding dimensions 1 through E_max.\n" + << "[fnn] Output 'E:i' (where i = 1 to E_max-1) corresponds to the comparison between dimension i and i+1.\n"; return result; } From 947713a98a924cc5efc52dd0bc1a12fce2a2ae76 Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 1 Jun 2026 00:00:01 +0800 Subject: [PATCH 4/7] clarify output indexing and boundary handling in fnn --- src/FNN.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/FNN.cpp b/src/FNN.cpp index 8cce8ee..7639e42 100644 --- a/src/FNN.cpp +++ b/src/FNN.cpp @@ -261,9 +261,8 @@ Rcpp::NumericVector RcppFNN( result.names() = resnames; // Terminal-friendly hint (one-time, non-intrusive) - Rcpp::Rcout << "[fnn] Input E values exceeding max embeddable dimension were truncated.\n" - << "[fnn] Max embedding dimension E_max is auto-computed; E_max < 2 are forced to 2.\n" - << "[fnn] Results are returned for embedding dimensions 1 through E_max.\n" + Rcpp::Rcout << "[fnn] Input E values exceeding max embeddable dimension were truncated, and input values < 2 were clamped to 2.\n" + << "[fnn] Max embedding dimension E_max is auto-computed, with results returned for dimensions 1 through E_max.\n" << "[fnn] Output 'E:i' (where i = 1 to E_max-1) corresponds to the comparison between dimension i and i+1.\n"; return result; From 905be97bea6da5170ecfa2bc0942752b469d935a Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 1 Jun 2026 00:00:01 +0800 Subject: [PATCH 5/7] clarify output indexing and boundary handling in fnn --- src/FNN.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FNN.cpp b/src/FNN.cpp index 7639e42..13c2738 100644 --- a/src/FNN.cpp +++ b/src/FNN.cpp @@ -261,7 +261,7 @@ Rcpp::NumericVector RcppFNN( result.names() = resnames; // Terminal-friendly hint (one-time, non-intrusive) - Rcpp::Rcout << "[fnn] Input E values exceeding max embeddable dimension were truncated, and input values < 2 were clamped to 2.\n" + Rcpp::Rcout << "[fnn] Input E values exceeding max embeddable dimension were truncated, and values < 2 were clamped to 2.\n" << "[fnn] Max embedding dimension E_max is auto-computed, with results returned for dimensions 1 through E_max.\n" << "[fnn] Output 'E:i' (where i = 1 to E_max-1) corresponds to the comparison between dimension i and i+1.\n"; From adcb6116292b7f301c50be819402981c04ddbc5f Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Mon, 1 Jun 2026 00:00:01 +0800 Subject: [PATCH 6/7] clarify output indexing and boundary handling in fnn --- man/fnn.Rd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/man/fnn.Rd b/man/fnn.Rd index 05570fa..f710f90 100644 --- a/man/fnn.Rd +++ b/man/fnn.Rd @@ -10,7 +10,7 @@ \S4method{fnn}{data.frame}( data, target, - E = 2:10, + E = 10, k = 1, tau = 1, style = 1, @@ -27,7 +27,7 @@ \S4method{fnn}{sf}( data, target, - E = 3:10, + E = 10, k = 1, tau = 1, style = 1, @@ -46,7 +46,7 @@ \S4method{fnn}{SpatRaster}( data, target, - E = 3:10, + E = 10, k = 1, tau = 1, style = 1, From 047936ee166cfb7590b6ada9f1a34959fb561f2f Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Tue, 2 Jun 2026 00:00:01 +0800 Subject: [PATCH 7/7] clarify output indexing and boundary handling in fnn --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index 4a60a7b..d434908 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # pc 0.3 +### enhancements + +* Clarify output indexing and boundary handling in `fnn` generic (#69). + # pc 0.2 ### new