Skip to content

Incorrect error messages when predefined parameters in ets models when using future calls #412

@GBarnsley-ukhsa

Description

@GBarnsley-ukhsa

I seem to be getting error messages about objects not being found when I use an object from outside the ets call to defined something in the ETS formula. This only occurs in a very specific scenario where I'm using a multisession future (not tested multicore) and parameters are out of range

Could be related to #405

See the code below, the first couple of examples suffice for a minimal working example

library(tsibble)
library(fabletools)
library(future)

# specify a parameter outside the ETS call
alpha <- 0.666

# run model, no paralleism

fabletools::model(
  tourism,
  ets = fable::ETS(
    Trips ~ error("A") +
      trend(
        "A",
        alpha = alpha,
        beta = 0.610
      ) +
      season(
        "A",
        period = "4 year",
        gamma = 0.1
      )
  )
)

#correct error, parameters out of range

future::plan(future::sequential())

fabletools::model(
  tourism,
  ets = fable::ETS(
   Trips ~ error("A") +
      trend(
        "A",
        alpha = alpha,
        beta = 0.610
      ) +
      season(
        "A",
        period = "4 year",
        gamma = 0.1
      )
  )
)

#correct error, parameters out of range

future::plan(future::multisession(workers = 2))

fabletools::model(
  tourism,
  ets = fable::ETS(
    Trips ~ error("A") +
      trend(
        "A",
        alpha = alpha,
        beta = 0.610
      ) +
      season(
        "A",
        period = "4 year",
        gamma = 0.1
      )
  )
)

# error about how alpha cannot be found

lambda <- 0.3
fabletools::model(
  tourism,
  ets = fable::ETS(
   Trips ~ error("A") +
      trend(
        "A",
        alpha = 0.666,
        beta = 0.610
      ) +
      season(
        "A",
        period = "4 year",
        gamma = 0.1
      )
  )
)

# different error (also wrong) if in the transformation

# but works if not out of range

fabletools::model(
  tourism,
  ets = fable::ETS(
   Trips ~ error("A") +
      trend(
        "A",
        alpha = alpha,
        beta = 0.610
      ) +
      season(
        "A",
        period = "1 year",
        gamma = 0.1
      )
  )
)

fabletools::model(
  tourism,
  ets = fable::ETS(
    fabletools::box_cox(Trips, lambda) ~ error("A") +
      trend(
        "A",
        alpha = 0.666,
        beta = 0.610
      ) +
      season(
        "A",
        period = "1 year",
        gamma = 0.1
      )
  )
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions