Learn R Programming

NoiseFiltersR (version 0.1.0)

CNN: Condensed Nearest Neighbors

Description

Similarity-based method designed to select the most relevant instances for subsequent classification with a nearest neighbor rule. For more information, see 'Details' and 'References' sections.

Usage

"CNN"(formula, data, ...)
"CNN"(x, classColumn = ncol(x), ...)

Arguments

formula
A formula describing the classification variable and the attributes to be used.
data, x
Data frame containing the tranining dataset to be filtered.
...
Optional parameters to be passed to other methods.
classColumn
positive integer indicating the column which contains the (factor of) classes. By default, the last column is considered.

Value

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.

Details

CNN searches for a 'consistent subset' of the provided dataset, i.e. a subset that is enough for correctly classifying the rest of instances by means of 1-NN. To do so, CNN stores the first instance and goes for a first sweep over the dataset, adding to the stored bag those instances which are not correctly classified by 1-NN taking the stored bag as training set. Then, the process is iterated until all non-stored instances are correctly classified.

Although CNN is not strictly a label noise filter, it is included here for completeness, since the origins of noise filters are connected with instance selection algorithms.

References

Hart P. (May, 1968): The condensed nearest neighbor rule, IEEE Trans. Inf. Theory, vol. 14, no. 5, pp. 515-516.

See Also

RNN

Examples

Run this code
# Next example is not run in order to save time
## Not run: 
# data(iris)
# out <- CNN(iris)
# print(out)
# length(out$remIdx)
# identical(out$cleanData, iris[setdiff(1:nrow(iris),out$remIdx),])
# ## End(Not run)

Run the code above in your browser using DataLab