gpt4 book ai didi

namespaces - 错误 : 'attrition' is not an exported object from 'namespace:rsample'

转载 作者:行者123 更新时间:2023-12-04 16:51:21 24 4
gpt4 key购买 nike

我正在使用 Bradley Boehmke 所著的 Hands on Machine Learning 一书。我写了以下行来访问数据,但我给出了这个错误。
损耗 <- rsample::attrition
错误:“损耗”不是从“命名空间:rsample”导出的对象

最佳答案

我以前遇到过同样的问题,但后来我发现现在attrition DataFrame 属于 modeldata包裹。只需使用以下代码:

# Load the required libraries first

my_libraries <- c("rsample","modeldata","caret", "h2o", "dplyr",
"ggplot2")
lapply(my_libraries, require, character.only = T)


# **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()

关于namespaces - 错误 : 'attrition' is not an exported object from 'namespace:rsample' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65397753/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com