File: oversample.Rd

package info (click to toggle)
r-cran-mlr 2.19.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,264 kB
  • sloc: ansic: 65; sh: 13; makefile: 5
file content (44 lines) | stat: -rw-r--r-- 1,467 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/OverUnderSampling.R
\name{oversample}
\alias{oversample}
\alias{undersample}
\title{Over- or undersample binary classification task to handle class imbalancy.}
\usage{
oversample(task, rate, cl = NULL)

undersample(task, rate, cl = NULL)
}
\arguments{
\item{task}{(\link{Task})\cr
The task.}

\item{rate}{(\code{numeric(1)})\cr
Factor to upsample or downsample a class.
For undersampling: Must be between 0 and 1,
where 1 means no downsampling, 0.5 implies reduction to 50 percent
and 0 would imply reduction to 0 observations.
For oversampling: Must be between 1 and \code{Inf},
where 1 means no oversampling and 2 would mean doubling the class size.}

\item{cl}{(\code{character(1)})\cr
Which class should be over- or undersampled. If \code{NULL}, \code{oversample}
will select the smaller and \code{undersample} the larger class.}
}
\value{
\link{Task}.
}
\description{
Oversampling: For a given class (usually the smaller one) all existing observations are
taken and copied and extra observations are added by randomly sampling with replacement from this class.

Undersampling: For a given class (usually the larger one) the number of observations is
reduced (downsampled) by randomly sampling without replacement from this class.
}
\seealso{
Other imbalancy: 
\code{\link{makeOverBaggingWrapper}()},
\code{\link{makeUndersampleWrapper}()},
\code{\link{smote}()}
}
\concept{imbalancy}