Create a ML-KNN classifier to predict multi-label data. It is a multi-label lazy learning, which is derived from the traditional K-nearest neighbor (KNN) algorithm. For each unseen instance, its K nearest neighbors in the training set are identified and based on statistical information gained from the label sets of these neighboring instances, the maximum a posteriori (MAP) principle is utilized to determine the label set for the unseen instance.
mlknn(
mdata,
k = 10,
s = 1,
distance = "euclidean",
...,
cores = getOption("utiml.cores", 1),
seed = getOption("utiml.seed", NA)
)
A mldr dataset used to train the binary models.
The number of neighbors. (Default: 10
)
Smoothing parameter controlling the strength of uniform prior. When
it is set to be 1, we have the Laplace smoothing. (Default: 1
).
The name of method used to compute the distance. See
dist
to the list of options.
(Default: "euclidian"
)
Not used.
Ignored because this method does not support multi-core.
Ignored because this method is deterministic.
An object of class MLKNNmodel
containing the set of fitted
models, including:
A vector with the label names.
The prior probability of each label to occur.
The posterior probability of each label to occur given that k neighbors have it.
Zhang, M.L. L., & Zhou, Z.H. H. (2007). ML-KNN: A lazy learning approach to multi-label learning. Pattern Recognition, 40(7), 2038-2048.
# NOT RUN {
model <- mlknn(toyml, k=3)
pred <- predict(model, toyml)
# }
Run the code above in your browser using DataLab