# Run before any test
suppressPackageStartupMessages(library(recipes))
suppressPackageStartupMessages(library(ggplot2))
suppressPackageStartupMessages(library(data.tree))


# ames small data
utils::data("ames", package = "modeldata")
ids <- sample(nrow(ames), 256)
small_ames <- ames[ids,]
x <- ames[ids,-which(names(ames) == "Sale_Price")]
y <- ames[ids,]$Sale_Price


# attrition small data
utils::data("attrition", package = "modeldata")
ids <- sample(nrow(attrition), 256)

# attrition common models
attrix <- attrition[ids,-which(names(attrition) == "Attrition")]
attri_mult_x <- attrix[-which(names(attrix) == "JobSatisfaction")]

attriy <- attrition[ids,]$Attrition

# data.tree Node dataset
utils::data("acme", package = "data.tree")
acme_df <-  data.tree::ToDataFrameTypeCol(acme, acme$attributesAll) %>%
  select(-starts_with("level_"))
# acme2 <- acme$clone()
# acme2$RemoveAttribute("level_3")

attrition_tree <- attrition %>%
  tibble::rowid_to_column() %>%
  mutate(pathString = paste("attrition", Department, JobRole, rowid, sep = "/")) %>%
  select(-Department, -JobRole, -rowid) %>%
  data.tree::as.Node()
