skcla_knn {daltoolboxdp} | R Documentation |
K-Nearest Neighbors Classifier
Description
Implements classification using the K-Nearest Neighbors algorithm. This function wraps the KNeighborsClassifier from Python's scikit-learn library.
Usage
skcla_knn(
attribute,
slevels,
n_neighbors = 5,
weights = "uniform",
algorithm = "auto",
leaf_size = 30,
p = 2,
metric = "minkowski",
metric_params = NULL,
n_jobs = NULL
)
Arguments
attribute |
Target attribute name for model building |
slevels |
List of possible values for classification target |
n_neighbors |
Number of neighbors to use for queries |
weights |
Weight function used in prediction ('uniform', 'distance') |
algorithm |
Algorithm used to compute nearest neighbors ('auto', 'ball_tree', 'kd_tree', 'brute') |
leaf_size |
Leaf size passed to BallTree or KDTree |
p |
Power parameter for the Minkowski metric |
metric |
Distance metric for the tree ('euclidean', 'manhattan', 'chebyshev', 'minkowski', etc.) |
metric_params |
Additional parameters for the metric function |
n_jobs |
Number of parallel jobs for neighbor searches |
Details
K-Nearest Neighbors Classifier
Value
A K-Nearest Neighbors classifier object
skcla_knn
object
Examples
#See an example of using `skcla_knn` at this
#https://github.com/cefet-rj-dal/daltoolboxdp/blob/main/examples/skcla_knn.md