sym_def_ln: Symmetric default label noise

View source: R/038_sym_def_ln.R

sym_def_lnR Documentation

Symmetric default label noise

Description

Introduction of Symmetric default label noise into a classification dataset.

Usage

## Default S3 method:
sym_def_ln(x, y, level, def = 1, order = levels(y), sortid = TRUE, ...)

## S3 method for class 'formula'
sym_def_ln(formula, data, ...)

Arguments

x

a data frame of input attributes.

y

a factor vector with the output class of each sample.

level

a double in [0,1] with the noise level to be introduced.

def

an integer with the index of the default class (default: 1).

order

a character vector indicating the order of the classes (default: levels(y)).

sortid

a logical indicating if the indices must be sorted at the output (default: TRUE).

...

other options to pass to the function.

formula

a formula with the output class and, at least, one input attribute.

data

a data frame in which to interpret the variables in the formula.

Details

Symmetric default label noise randomly selects (level·100)% of the samples in the dataset with independence of their class. Then, the labels of these samples are replaced by a fixed label (def) within the set of class labels. The index def is taken according to the order given by order.

Value

An object of class ndmodel with elements:

xnoise

a data frame with the noisy input attributes.

ynoise

a factor vector with the noisy output class.

numnoise

an integer vector with the amount of noisy samples per class.

idnoise

an integer vector list with the indices of noisy samples.

numclean

an integer vector with the amount of clean samples per class.

idclean

an integer vector list with the indices of clean samples.

distr

an integer vector with the samples per class in the original data.

model

the full name of the noise introduction model used.

param

a list of the argument values.

call

the function call.

Note

Noise model adapted from the papers in References.

References

M. Ren, W. Zeng, B. Yang, and R. Urtasun. Learning to reweight examples for robust deep learning. In Proc. 35th International Conference on Machine Learning, volume 80 of PMLR, pages 4331-4340, 2018. url:http://proceedings.mlr.press/v80/ren18a.html.

See Also

sym_ddef_ln, sym_exc_ln, print.ndmodel, summary.ndmodel, plot.ndmodel

Examples

# load the dataset
data(iris2D)

# usage of the default method
set.seed(9)
outdef <- sym_def_ln(x = iris2D[,-ncol(iris2D)], y = iris2D[,ncol(iris2D)], 
                     level = 0.1, order = c("virginica", "setosa", "versicolor"))

# show results
summary(outdef, showid = TRUE)
plot(outdef)

# usage of the method for class formula
set.seed(9)
outfrm <- sym_def_ln(formula = Species ~ ., data = iris2D,
                     level = 0.1, order = c("virginica", "setosa", "versicolor"))

# check the match of noisy indices
identical(outdef$idnoise, outfrm$idnoise)


noisemodel documentation built on Oct. 17, 2022, 9:05 a.m.