我愿意使用multidplyr和prophet进行并行预测。请考虑以下数据
SessionInterceptorFactory
虽然我能够使用
进行每组顺序预测library(tidyr)
library(dplyr)
library(multidplyr)
library(prophet)
ds = as.Date(c('2016-11-01', '2016-11-02', '2016-11-03', '2016-11-04',
'2016-11-05', '2016-11-06', '2016-11-07', '2016-11-08',
'2016-11-09', '2016-11-10', '2016-11-11', '2016-11-12',
'2016-11-13', '2016-11-14', '2016-11-15', '2016-11-16',
'2016-11-17', '2016-11-18', '2016-11-19', '2016-11-20',
'2016-11-21', '2016-11-22', '2016-11-23', '2016-11-24',
'2016-11-25', '2016-11-26', '2016-11-27', '2016-11-28',
'2016-11-29', '2016-11-30', '2016-11-01', '2016-11-02',
'2016-11-03', '2016-11-04', '2016-11-05', '2016-11-06',
'2016-11-07', '2016-11-08', '2016-11-09', '2016-11-10',
'2016-11-11', '2016-11-12', '2016-11-13', '2016-11-14',
'2016-11-15', '2016-11-16', '2016-11-17', '2016-11-18',
'2016-11-19', '2016-11-20', '2016-11-21', '2016-11-22',
'2016-11-23', '2016-11-24', '2016-11-25', '2016-11-26',
'2016-11-27', '2016-11-28', '2016-11-29', '2016-11-30'))
y = c(15, 17, 18, 19, 20, 54, 67, 23, 12, 34, 12, 78, 34, 12, 3, 45, 67, 89, 12, 111, 123, 112, 14, 566, 345, 123, 567, 56, 87, 90, 45, 23, 12, 10, 21, 34, 12, 45, 12, 44, 87, 45, 32, 67, 1, 57, 87, 99, 33, 234, 456, 123, 89, 333, 411, 232, 455, 55, 90, 21)
group = c("A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B",
"B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B")
df = data.frame(ds, group, y)
我无法将其并行化。到目前为止,我已根据建议使用df %>%
group_by(group) %>%
do(predict(prophet::prophet(.), prophet::make_future_dataframe(prophet::prophet(.), periods = 7)))
和partition
命令here
collect
这给了我一个错误
multidplyr::cluster_library(cluster, "prophet")
df %>%
partition(group) %>%
do(predict(prophet::prophet(.), prophet::make_future_dataframe(prophet::prophet(.), periods = 7))) %>%
collect()
或者喜欢以下
Error in checkForRemoteErrors(lapply(cl, recvResult)) :
2 nodes produced errors; first error: 'data' must be of a vector type, was 'NULL'
In addition: Warning message:
group_indices_.grouped_df ignores extra arguments
这给了我以下错误
multidplyr::cluster_library(cluster, "purrr")
multidplyr::cluster_library(cluster, "prophet")
df %>%
partition(group) %>%
mutate(m = purrr::map(data, prophet::prophet)) %>%
mutate(future = purrr::map(m, prophet::make_future_dataframe, period = 7)) %>%
mutate(forecast = purrr::map2(m, future, predict)) %>%
collect()
因此,我迷失了如何继续前进。任何建议都非常受欢迎。提前谢谢。
Ps。:这是我的Error in checkForRemoteErrors(lapply(cl, recvResult)) :
2 nodes produced errors; first error: Evaluation error: `.x` is not a vector (closure).
In addition: Warning message:
group_indices_.grouped_df ignores extra arguments
sessionInfo()