Similarity-based filter 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
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.
Character indicating the type of graph to be constructed. It can be chosen between 'GG' (Gabriel Graph) and 'RNG' (Relative Neighborhood Graph). See 'References' for more details on both graphs.
positive integer indicating the column which contains the (factor of) classes. By default, the last column is considered.
ENG builds a neighborhood graph which can be either Gabriel Graph (GG) or
Relative Neighborhood Graph (RNG) [S\'anchez et al., 1997]. Then, an
instance is considered as 'potentially noisy' if most of its neighbors have a different class. To decide whether such
an instance 'X' is removed, let S be the subset given by 'X' together with its neighbors from the same class.
Compute the majority class 'C' among the neighbors of examples in S, and remove 'X' if its class is not 'C'.
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.
S\'anchez J. S., Pla F., Ferri F. J. (1997): Prototype selection for the nearest neighbour rule through proximity graphs. Pattern Recognition Letters, 18(6), 507-513.
1 2 3 4 5 6 7 8 9
# The example is not run because the graph construction is quite time-consuming. ## Not run: data(iris) trainData <- iris[c(1:20,51:70,101:120),] out <- ENG(Species~Petal.Length + Petal.Width, data = trainData, graph = "RNG") print(out) identical(out$cleanData,trainData[setdiff(1:nrow(trainData),out$remIdx),]) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.