【问题标题】:Error: 'attrition' is not an exported object from 'namespace:rsample'错误:'attrition' 不是从 'namespace:rsample' 导出的对象
【发布时间】:2021-03-31 12:15:48
【问题描述】:

我正在使用 Bradley Boehmke 撰写的《机器学习实践》一书。我写了以下行来访问数据,但我给出了这个错误。

损耗

【问题讨论】:

    标签: namespaces


    【解决方案1】:
    library(modeldata)
    data("attrition", package = "modeldata")
    churn <- attrition %>% mutate_if(is.ordered, .funs = factor,ordered = F)
    

    【讨论】:

      【解决方案2】:

      我曾经遇到过同样的问题,但后来我发现现在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()
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-01-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-03-31
        • 1970-01-01
        相关资源
        最近更新 更多