ipfKnn {ipft} | R Documentation |
Implements the k-nearest neighbors algorithm
Description
Implements the k-nearest neighbors algorithm
Usage
ipfKnn(train_fgp, train_pos, k = 3, method = "euclidean",
weights = "distance", norm = 2, sd = 5, epsilon = 0.001, alpha = 1,
threshold = 20, FUN = NULL, ...)
Arguments
train_fgp |
a data frame containing the fingerprint vectors of the training set |
train_pos |
a data frame containing the positions of the training set observations |
k |
the k parameter for knn algorithm (number of nearest neighbors) |
method |
the method to compute the distance between the RSSI vectors: 'euclidean', 'manhattan', 'norm', 'LGD' or 'PLGD' |
weights |
the algorithm to compute the weights: 'distance' or 'uniform' |
norm |
parameter for the 'norm' method |
sd |
parameter for 'LGD' and 'PLGD' methods |
epsilon |
parameter for 'LGD' and 'PLGD' methods |
alpha |
parameter for 'PLGD' method |
threshold |
parameter for 'PLGD' method |
FUN |
an alternative function provided to compute the distance. This function must return a matrix of dimensions: nrow(test) x nrow(train), containing the distances from test observations to train observations. The two first parameters taken by the function must be train and test |
... |
additional parameters for provided function FUN |
Value
An S3 object of class ipfModel, with the following properties: params -> a list with the parameters passed to the function data -> a list with the fingerprints and locations
Examples
model <- ipfKnn(ipftrain[, 1:168], ipftrain[, 169:170], k = 9, method = 'manhattan')