【发布时间】:2021-03-31 12:15:48
【问题描述】:
我正在使用 Bradley Boehmke 撰写的《机器学习实践》一书。我写了以下行来访问数据,但我给出了这个错误。
损耗
【问题讨论】:
标签: namespaces
我正在使用 Bradley Boehmke 撰写的《机器学习实践》一书。我写了以下行来访问数据,但我给出了这个错误。
损耗
【问题讨论】:
标签: namespaces
library(modeldata)
data("attrition", package = "modeldata")
churn <- attrition %>% mutate_if(is.ordered, .funs = factor,ordered = F)
【讨论】:
我曾经遇到过同样的问题,但后来我发现现在attrition DataFrame 属于modeldata 包。只需使用以下代码:
# Load the required libraries first
my_libraries <- c("rsample","modeldata","caret", "h2o", "dplyr",
"ggplot2")
lapply(my_libraries, require, character.only = T)
# update 24.12.2021: it is best to call the dataset like:
data(attrition)
# **PROBLEM STATEMENT** here: there is a list of ordered factor variables,
# which is not_possible for h2o to deal with.
# for Job attrition data
churn <- attrition %>% mutate_if(is.ordered, .funs = factor,ordered = F)
# NOTE: funs() can create a list of function calls.
churn.h2o <- as.h2o(churn)
churn.h2o %>% View()
【讨论】: