sparklyr的数据帧转换器在转动时失败了吗?

时间:2018-02-14 10:46:28

标签: r sparklyr

我试图在sparklyr中使用管道意识形态来构建ML例程。

显然ft_dplyr_transformer不支持表格旋转,因为这部分:

%>% sdf_pivot(formula = Who + time_period ~ What_Action, fun.aggregate = "count") %>%
              na.replace(0)

粉碎整体结果。如果我省略它,其余的工作正常。

是否真的如此,或者我错过了流水线的一些基础知识?

spark_ml_pipeline <- 
     ml_pipeline(r_spark_connection) %>%
     ft_dplyr_transformer(
          preprocessed_spark_df %>%
          mutate(
               time_period = if(Date < '2017-12-01') {
                    'train_period'
               } else {
                    'test_period'
               }
          ) %>%
          mutate(
               What_Action = translate(What_Action, ' ', '_')
          ) %>%
          filter(
               !ObjectType %in% c('logon')
          ) %>%
          sdf_pivot(formula = Who + time_period ~ What_Action, fun.aggregate = "count") %>%
          na.replace(0)
     )

该函数的帮助内容为:

  

实现由SQL语句定义的转换。   目前我们只支持SQL语法,如'SELECT ... FROM THIS   ...'where' THIS '代表输入的基础表   数据集。

0 个答案:

没有答案