Similarity-based filters for removing label noise from a dataset as a preprocessing step of classification. For more information, see 'Details' and 'References' sections.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
## S3 method for class 'formula' DROP1(formula, data, ...) ## Default S3 method: DROP1(x, k = 1, classColumn = ncol(x), ...) ## S3 method for class 'formula' DROP2(formula, data, ...) ## Default S3 method: DROP2(x, k = 1, classColumn = ncol(x), ...) ## S3 method for class 'formula' DROP3(formula, data, ...) ## Default S3 method: DROP3(x, k = 1, classColumn = ncol(x), ...)
A formula describing the classification variable and the attributes to be used.
Data frame containing the tranining dataset to be filtered.
Optional parameters to be passed to other methods.
Number of nearest neighbors to be used.
positive integer indicating the column which contains the (factor of) classes. By default, the last column is considered.
DROP1 goes over the dataset in the provided order, and removes those
instances whose removal does not decrease the accuracy of the 1-NN rule in
the remaining dataset.
DROP2 introduces two modifications against
DROP1. Regarding the
order of processing instances,
DROP2 starts with those which are
furthest from their nearest "enemy" (two instances are said to be "enemies"
if they belong to different classes). Moreover,
DROP2 removes an
instance if its removal does not decrease the accuracy of the 1-NN rule in
the original dataset (rather than the remaining dataset as in
DROP3 is identical to
DROP2, but it includes a preprocessing
step to clean the borders between classes. It consists of applying the
ENN method: any instance misclassified by its k nearest
neighbors is removed.
An object of class
filter, which is a list with seven components:
cleanData is a data frame containing the filtered dataset.
remIdx is a vector of integers indicating the indexes for
removed instances (i.e. their row number with respect to the original data frame).
repIdx is a vector of integers indicating the indexes for
repaired/relabelled instances (i.e. their row number with respect to the original data frame).
repLab is a factor containing the new labels for repaired instances.
parameters is a list containing the argument values.
call contains the original call to the filter.
extraInf is a character that includes additional interesting
information not covered by previous items.
Wilson D. R., Martinez T. R. (2000): Reduction techniques for instance-based learning algorithms. Machine learning, 38(3), 257-286. Wilson D. R., Martinez T. R. (1997, July): Instance pruning techniques. In ICML (Vol. 97, pp. 403-411).
1 2 3 4 5 6 7 8 9
# Next example is not run in order to save time ## Not run: data(iris) trainData <- iris[c(1:20,51:70,101:120),] out1 <- DROP1(Species~ Petal.Length + Petal.Width, data = trainData) summary(out1, explicit = TRUE) identical(out1$cleanData, trainData[setdiff(1:nrow(trainData),out1$remIdx),]) ## End(Not run)