customer_churn_binarized_tbl <- customer_churn_tbl %>%
select(-customerID) %>%
mutate(TotalCharges = ifelse(is.na(TotalCharges), MonthlyCharges, TotalCharges)) %>%
binarize(n_bins = 5, thresh_infreq = 0.01, name_infreq = "OTHER", one_hot = TRUE)
customer_churn_binarized_tbl %>% glimpse()
#> Rows: 7,043
#> Columns: 60
#> $ gender__Female <dbl> 1, 0, 0, 0, 1, 1, 0, 1, 1,…
#> $ gender__Male <dbl> 0, 1, 1, 1, 0, 0, 1, 0, 0,…
#> $ SeniorCitizen__0 <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1,…
#> $ SeniorCitizen__1 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ Partner__No <dbl> 0, 1, 1, 1, 1, 1, 1, 1, 0,…
#> $ Partner__Yes <dbl> 1, 0, 0, 0, 0, 0, 0, 0, 1,…
#> $ Dependents__No <dbl> 1, 1, 1, 1, 1, 1, 0, 1, 1,…
#> $ Dependents__Yes <dbl> 0, 0, 0, 0, 0, 0, 1, 0, 0,…
#> $ `tenure__-Inf_6` <dbl> 1, 0, 1, 0, 1, 0, 0, 0, 0,…
#> $ tenure__6_20 <dbl> 0, 0, 0, 0, 0, 1, 0, 1, 0,…
#> $ tenure__20_40 <dbl> 0, 1, 0, 0, 0, 0, 1, 0, 1,…
#> $ tenure__40_60 <dbl> 0, 0, 0, 1, 0, 0, 0, 0, 0,…
#> $ tenure__60_Inf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ PhoneService__No <dbl> 1, 0, 0, 1, 0, 0, 0, 1, 0,…
#> $ PhoneService__Yes <dbl> 0, 1, 1, 0, 1, 1, 1, 0, 1,…
#> $ MultipleLines__No <dbl> 0, 1, 1, 0, 1, 0, 0, 0, 0,…
#> $ MultipleLines__No_phone_service <dbl> 1, 0, 0, 1, 0, 0, 0, 1, 0,…
#> $ MultipleLines__Yes <dbl> 0, 0, 0, 0, 0, 1, 1, 0, 1,…
#> $ InternetService__DSL <dbl> 1, 1, 1, 1, 0, 0, 0, 1, 0,…
#> $ InternetService__Fiber_optic <dbl> 0, 0, 0, 0, 1, 1, 1, 0, 1,…
#> $ InternetService__No <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ OnlineSecurity__No <dbl> 1, 0, 0, 0, 1, 1, 1, 0, 1,…
#> $ OnlineSecurity__No_internet_service <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ OnlineSecurity__Yes <dbl> 0, 1, 1, 1, 0, 0, 0, 1, 0,…
#> $ OnlineBackup__No <dbl> 0, 1, 0, 1, 1, 1, 0, 1, 1,…
#> $ OnlineBackup__No_internet_service <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ OnlineBackup__Yes <dbl> 1, 0, 1, 0, 0, 0, 1, 0, 0,…
#> $ DeviceProtection__No <dbl> 1, 0, 1, 0, 1, 0, 1, 1, 0,…
#> $ DeviceProtection__No_internet_service <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ DeviceProtection__Yes <dbl> 0, 1, 0, 1, 0, 1, 0, 0, 1,…
#> $ TechSupport__No <dbl> 1, 1, 1, 0, 1, 1, 1, 1, 0,…
#> $ TechSupport__No_internet_service <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ TechSupport__Yes <dbl> 0, 0, 0, 1, 0, 0, 0, 0, 1,…
#> $ StreamingTV__No <dbl> 1, 1, 1, 1, 1, 0, 0, 1, 0,…
#> $ StreamingTV__No_internet_service <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ StreamingTV__Yes <dbl> 0, 0, 0, 0, 0, 1, 1, 0, 1,…
#> $ StreamingMovies__No <dbl> 1, 1, 1, 1, 1, 0, 1, 1, 0,…
#> $ StreamingMovies__No_internet_service <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ StreamingMovies__Yes <dbl> 0, 0, 0, 0, 0, 1, 0, 0, 1,…
#> $ `Contract__Month-to-month` <dbl> 1, 0, 1, 0, 1, 1, 1, 1, 1,…
#> $ Contract__One_year <dbl> 0, 1, 0, 1, 0, 0, 0, 0, 0,…
#> $ Contract__Two_year <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ PaperlessBilling__No <dbl> 0, 1, 0, 1, 0, 0, 0, 1, 0,…
#> $ PaperlessBilling__Yes <dbl> 1, 0, 1, 0, 1, 1, 1, 0, 1,…
#> $ `PaymentMethod__Bank_transfer_(automatic)` <dbl> 0, 0, 0, 1, 0, 0, 0, 0, 0,…
#> $ `PaymentMethod__Credit_card_(automatic)` <dbl> 0, 0, 0, 0, 0, 0, 1, 0, 0,…
#> $ PaymentMethod__Electronic_check <dbl> 1, 0, 0, 0, 1, 1, 0, 0, 1,…
#> $ PaymentMethod__Mailed_check <dbl> 0, 1, 1, 0, 0, 0, 0, 1, 0,…
#> $ `MonthlyCharges__-Inf_25.05` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ MonthlyCharges__25.05_58.83 <dbl> 1, 1, 1, 1, 0, 0, 0, 1, 0,…
#> $ MonthlyCharges__58.83_79.1 <dbl> 0, 0, 0, 0, 1, 0, 0, 0, 0,…
#> $ MonthlyCharges__79.1_94.25 <dbl> 0, 0, 0, 0, 0, 0, 1, 0, 0,…
#> $ MonthlyCharges__94.25_Inf <dbl> 0, 0, 0, 0, 0, 1, 0, 0, 1,…
#> $ `TotalCharges__-Inf_265.32` <dbl> 1, 0, 1, 0, 1, 0, 0, 0, 0,…
#> $ TotalCharges__265.32_939.78 <dbl> 0, 0, 0, 0, 0, 1, 0, 1, 0,…
#> $ TotalCharges__939.78_2043.71 <dbl> 0, 1, 0, 1, 0, 0, 1, 0, 0,…
#> $ TotalCharges__2043.71_4471.44 <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 1,…
#> $ TotalCharges__4471.44_Inf <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0,…
#> $ Churn__No <dbl> 1, 1, 0, 1, 0, 0, 1, 1, 0,…
#> $ Churn__Yes <dbl> 0, 0, 1, 0, 1, 1, 0, 0, 1,…