LearnerKnn | R Documentation |
This learner is a wrapper around class::knn()
in order to perform a
k-nearest neighbor classification.
Optimization metric: classification error rate Can be used with
MLTuneParameters
MLCrossValidation
MLNestedCV
Implemented methods:
$fit
To fit the model.
$predict
To predict new data with the model.
$cross_validation
To perform a grid search (hyperparameter
optimization).
$bayesian_scoring_function
To perform a Bayesian hyperparameter
optimization.
For the two hyperparameter optimization strategies ("grid" and "bayesian"),
the parameter metric_optimization_higher_better
of the learner is
set to FALSE
by default as the classification error rate
(mlr3measures::ce()
) is used as the optimization metric.
mlexperiments::MLLearnerBase
-> LearnerKnn
new()
Create a new LearnerKnn
object.
LearnerKnn$new()
This learner is a wrapper around class::knn()
in order to perform a
k-nearest neighbor classification. The following experiments are
implemented:
MLTuneParameters
MLCrossValidation
MLNestedCV
For the two hyperparameter optimization strategies ("grid" and
"bayesian"), the parameter metric_optimization_higher_better
of the
learner is set to FALSE
by default as the classification error rate
(mlr3measures::ce()
) is used as the optimization metric.
LearnerKnn$new()
clone()
The objects of this class are cloneable with this method.
LearnerKnn$clone(deep = FALSE)
deep
Whether to make a deep clone.
class::knn()
, mlr3measures::ce()
class::knn()
, mlr3measures::ce()
LearnerKnn$new()
## ------------------------------------------------
## Method `LearnerKnn$new`
## ------------------------------------------------
LearnerKnn$new()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.