% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/neighbors_methods.R
\name{neighbors}
\alias{neighbors}
\alias{neighbors_k}
\alias{neighbors_diss}
\title{Neighbor selection methods}
\usage{
neighbors_k(k)

neighbors_diss(threshold, k_min = 4L, k_max = Inf)
}
\arguments{
\item{k}{Integer vector. One or more neighborhood sizes to evaluate.
Values will be sorted in ascending order. Minimum allowed value is 4.}

\item{threshold}{Numeric vector. One or more dissimilarity thresholds.
Neighbors are selected if their dissimilarity to the target observation
is below the threshold. Values will be sorted in ascending order.}

\item{k_min}{Integer. Minimum number of neighbors to retain, regardless of
threshold. Default \code{4L}.}

\item{k_max}{Integer or \code{Inf}. Maximum number of neighbors to retain,
regardless of threshold. Default \code{Inf} (no upper bound other than
the size of the reference set).}
}
\value{
An object of class \code{c("neighbors_k", "neighbors")} or
\code{c("neighbors_diss", "neighbors")}, containing the validated
parameters. Intended to be passed to \code{\link{mbl}}.
}
\description{
These functions create configuration objects that specify how neighbors
are selected for memory-based learning in \code{\link{mbl}} an \code{\link{liblex}}.
}
\details{
Two strategies are available for neighbor selection:

\strong{Fixed-k selection} (\code{neighbors_k})

A fixed number of nearest neighbors is selected for each target observation.
Multiple values of \code{k} can be provided to evaluate different
neighborhood sizes.

\strong{Dissimilarity-threshold selection} (\code{neighbors_diss})

Neighbors are selected based on a dissimilarity threshold. All reference
observations with dissimilarity below the threshold are included. The
\code{k_min} and \code{k_max} arguments provide bounds to ensure a reasonable
neighborhood size regardless of the threshold. Multiple thresholds can be
provided to evaluate different settings.
}
\examples{
# Fixed neighborhood sizes
neighbors_k(k = 50)
neighbors_k(k = c(40, 60, 80, 100, 120))

# Dissimilarity threshold with default bounds
neighbors_diss(threshold = 0.3)

# Dissimilarity threshold with custom bounds
neighbors_diss(threshold = c(0.1, 0.2, 0.3), k_min = 10, k_max = 150)

}
\seealso{
\code{\link{mbl}}
}
