weight_target | R Documentation |
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)
data |
A dataset |
target |
Target variable (0/1, TRUE/FALSE, yes/no) |
Weights for each observation (as a vector)
iris$is_versicolor <- ifelse(iris$Species == "versicolor", 1, 0)
weights <- weight_target(iris, target = is_versicolor)
versicolor <- iris$is_versicolor
table(versicolor, weights)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.