rtidymodelstimetk

how can I fix date error when using modeltime's prophet_reg() for machine learning


I'm trying to use excellent timetk and modeltime package but for some reason on my work computer I get an error (that I don't get with my home computer). It appears related to lubridate but I'm unsure -- can anyone help?

Specifically when fitting the model I get the below error output.

Error in C_force_tz(to_posixct(time), tz, roll_dst) : CCTZ: Unrecognized output timezone: "GMT"

I'm using R 4.3 in 2023.03.1 Build 446 but had the same error when I had R 4.2.3

I tried the solution listed below and it didn't work

Error with timezone when fit prophet model


library(tidyverse)
library(timetk)
library(modeltime)
library(tidymodels)

df <- timetk::bike_sharing_daily
split <- timetk::time_series_split(df,assess = 200,cumulative = TRUE)


(train <- training(split))
(test <- testing(split))


rec <- recipe(cnt~dteday,data=train)

mod <- prophet_reg() %>% 
  set_engine("prophet")

wf <- workflow() %>% 
  add_recipe(rec) %>% 
  add_model(mod)


wf %>% fit(data=train)

Solution

  • This error was caused by dependency of lubridate. I forget which underlying package but re-installing the lubridate dependencies fixed the issue.