% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rose.R
\name{rose}
\alias{rose}
\title{ROSE Algorithm}
\usage{
rose(
  df,
  var,
  over_ratio = 1,
  minority_prop = 0.5,
  minority_smoothness = 1,
  majority_smoothness = 1
)
}
\arguments{
\item{df}{A data.frame or tibble. Must have 1 factor variable with exactly
2 levels and remaining numeric variables.}

\item{var}{Character, name of variable containing the 2-level factor
variable.}

\item{over_ratio}{A numeric value for the total size of the synthetic data
relative to twice the size of the majority class. Unlike the other
over-sampling steps this is not a per-class target, so a named vector of
ratios is not accepted here.}

\item{minority_prop}{A numeric value between 0 and 1 for the proportion of
synthetic observations from the minority class. Defaults to 0.5, which
generates an equal split of minority and majority synthetic observations.
This parameter controls the class balance \emph{within} the synthetic data,
while \code{over_ratio} controls the \emph{total size} of the synthetic data.}

\item{minority_smoothness}{A numeric. Shrink factor to be multiplied by the
smoothing parameters to estimate the conditional kernel density of the
minority class. Defaults to 1.}

\item{majority_smoothness}{A numeric. Shrink factor to be multiplied by the
smoothing parameters to estimate the conditional kernel density of the
majority class. Defaults to 1.}
}
\value{
A data.frame or tibble, depending on type of \code{df}.
}
\description{
A thin wrapper around \code{\link[ROSE:ROSE]{ROSE::ROSE()}} that generates a synthetic balanced
sample by enlarging the feature space of minority and majority class
examples.
}
\details{
The factor variable used to balance around must only have 2 levels.

The ROSE algorithm works by selecting an observation belonging to class k
and generating new examples in its neighborhood, which is determined by a
smoothing matrix H_k. Smaller values of \code{minority_smoothness} and
\code{majority_smoothness} shrink the entries of H_k, producing tighter
neighborhoods. This is a cautious choice when there is a concern that
excessively large neighborhoods could blur the boundaries between classes.

This function is a thin wrapper around \code{\link[ROSE:ROSE]{ROSE::ROSE()}}. For full details on
the underlying implementation, see that function's documentation.
}
\examples{
rose(circle_example[, c("x", "y", "class")], var = "class")

rose(circle_example[, c("x", "y", "class")], var = "class", over_ratio = 0.8)
}
\references{
Lunardon, N., Menardi, G., and Torelli, N. (2014). ROSE: a
Package for Binary Imbalanced Learning. R Journal, 6:79–89.

Menardi, G. and Torelli, N. (2014). Training and assessing
classification rules with imbalanced data. Data Mining and Knowledge
Discovery, 28:92–122.
}
\seealso{
\code{\link[=step_rose]{step_rose()}} for step function of this method

Other Direct Implementations:
\code{\link[=adasyn]{adasyn()}},
\code{\link[=bsmote]{bsmote()}},
\code{\link[=cluster_centroids]{cluster_centroids()}},
\code{\link[=cnn]{cnn()}},
\code{\link[=enn]{enn()}},
\code{\link[=instance_hardness]{instance_hardness()}},
\code{\link[=kmeans_smote]{kmeans_smote()}},
\code{\link[=ncl]{ncl()}},
\code{\link[=nearmiss]{nearmiss()}},
\code{\link[=oss]{oss()}},
\code{\link[=smogn]{smogn()}},
\code{\link[=smote]{smote()}},
\code{\link[=smoten]{smoten()}},
\code{\link[=smotenc]{smotenc()}},
\code{\link[=svmsmote]{svmsmote()}},
\code{\link[=tomek]{tomek()}}
}
\concept{Direct Implementations}
