Explain"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

The explore package offers a simplified way to use machine learning to understand and explain patterns in the data.

We use synthetic data in this example

library(dplyr)
library(explore)

data <- create_data_buy(obs = 1000)
glimpse(data)

Decision Tree

data %>% explain_tree(target = buy)
data %>% explain_tree(target = mobiledata_prd)
data %>% explain_tree(target = age)

Random Forrest

data %>% explain_forest(target = buy, ntree = 100)

Logistic Regression

data %>% explain_logreg(target = buy)

Balance Target

If you have a data set with a very unbalanced target (in this case only 5% of all observations have buy == 1) it may be difficult to create a decision tree.

data <- create_data_buy(obs = 2000, target1_prob = 0.05)
data %>% describe(buy)

It may help to balance the target before growing the decision tree (or use weighs as alternative). In this example we down sample the data so buy has 10% of target == 1.

data %>%
  balance_target(target = buy, min_prop = 0.10) %>%
  explain_tree(target = buy)


Try the explore package in your browser

Any scripts or data that you put into this service are public.

explore documentation built on Oct. 11, 2023, 9:07 a.m.