compare_target_numeric {alookr} | R Documentation |
Compare the statistics of the numerical variables of the train set and test set included in the "split_df" class.
compare_target_numeric(.data, ...)
.data |
an object of class "split_df", usually, a result of a call to split_df(). |
... |
one or more unquoted expressions separated by commas. Select the numeric variable you want to compare. You can treat variable names like they are positions. Positive values select variables; negative values to drop variables. If the first expression is negative, compare_target_numeric() will automatically start with all variables. These arguments are automatically quoted and evaluated in a context where column names represent column positions. They support unquoting and splicing. |
Compare the statistics of the numerical variables of the train set and the test set to determine whether the raw data is well separated into two data sets.
tbl_df. Variables for comparison:
variable : character. numeric variable name
train_mean : numeric. arithmetic mean of train set
test_mean : numeric. arithmetic mean of test set
train_sd : numeric. standard deviation of train set
test_sd : numeric. standard deviation of test set
train_z : numeric. the arithmetic mean of the train set divided by the standard deviation
test_z : numeric. the arithmetic mean of the test set divided by the standard deviation
library(dplyr)
# Credit Card Default Data
head(ISLR::Default)
# Generate data for the example
sb <- ISLR::Default %>%
split_by(default)
sb %>%
compare_target_numeric()
sb %>%
compare_target_numeric(balance)