sansa {sansa} | R Documentation |
Title
Description
Title
Usage
sansa(x, y, lambda = 0, ksel = 3)
Arguments
x |
Input predictor as a dataframe |
y |
Target variable as factor |
lambda |
Lambda parameter to select distribution of synthetic variables |
ksel |
K parameter to choose how many neighbors are used in calculations |
Value
A list with two elements: x contains predictors with synthetic data, y contains target with synthetic data.
Examples
library(sansa)
library(ggplot2)
minority = data.frame(x1 = rnorm(10, 10, 3),
x2 = rnorm(10, 25, 10),
target = "true")
majority = data.frame(x1 = rnorm(100, 4, 2),
x2 = rnorm(100, 30, 10),
target = "false")
dataset = rbind(minority, majority)
ggplot(dataset) + geom_point(aes(x1, x2, color = target))
sansaobject = sansa(x = dataset[,1:2], y = dataset$target, lambda = 1, ksel = 3)
balanced <- sansaobject$x
balanced$target = sansaobject$y
ggplot(balanced) + geom_point(aes(x1, x2, color = target))
[Package sansa version 0.0.1 Index]