% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/skcla_knn.R
\name{skcla_knn}
\alias{skcla_knn}
\title{K-Nearest Neighbors Classifier}
\usage{
skcla_knn(
  attribute,
  slevels,
  n_neighbors = 5,
  weights = c("uniform", "distance"),
  metric = c("euclidean", "manhattan", "chebyshev", "minkowski")
)
}
\arguments{
\item{attribute}{Target attribute name for model building.}

\item{slevels}{List of possible values for classification target.}

\item{n_neighbors}{Number of neighbors to use for queries.}

\item{weights}{Weight function used in prediction. One of \code{"uniform"} or \code{"distance"}.}

\item{metric}{Distance metric used by the neighbor search. One of
\code{"euclidean"}, \code{"manhattan"}, \code{"chebyshev"}, or \code{"minkowski"}.}
}
\value{
A \code{skcla_knn} classifier object.
}
\description{
Implements classification using the k-Nearest Neighbors algorithm.
Wraps scikit-learn's \code{KNeighborsClassifier} through \code{reticulate}.
}
\details{
K-Nearest Neighbors Classifier
}
\examples{
\dontrun{
data(iris)
clf <- skcla_knn(
  attribute = "Species",
  slevels = levels(iris$Species),
  n_neighbors = 7,
  weights = "distance"
)
clf <- daltoolbox::fit(clf, iris)
pred <- predict(clf, iris)
table(pred, iris$Species)
}
}
\references{
Cover, T., & Hart, P. (1967). Nearest neighbor pattern classification.
}
