powered by
Create weights for the target variable in your dataset so that are equal weights for target = 0 and target = 1. Target must be 0/1, FALSE/TRUE ore no/yes
weight_target(data, target)
Weights for each observation (as a vector)
A dataset
Target variable (0/1, TRUE/FALSE, yes/no)
iris$is_versicolor <- ifelse(iris$Species == "versicolor", 1, 0) weights <- weight_target(iris, target = is_versicolor) versicolor <- iris$is_versicolor table(versicolor, weights)
Run the code above in your browser using DataLab