Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A fable wrapper for TBATS

License

NotificationsYou must be signed in to change notification settings

JSzitas/fable.tbats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

R-CMD-checkCodecov test coverageLifecycle: stableCRAN status

fable.tbats is a wrapper around the implementation oftbatsoriginally from theforecastpackage, though it now works without this dependency.

Installation

pak::pkg_install("JSzitas/fable.tbats")

Usage

Used just like any model infable:

library(tsibbledata)library(fable)library(fable.tbats)library(dplyr)# fit models to the pelt dataset until 1930:train<-pelt %>%   filter(Year<1930)test<-pelt %>%   filter(Year>=1930)models<-train %>%   model(ets= ETS(Lynx),bats= BATS(Lynx),tbats= TBATS(Lynx)         )# generate forecasts on the test setforecasts<- forecast(models,test)# visualizeautoplot(forecasts,pelt)

Similarly, accuracy calculation works:

train_accuracies<- accuracy(models)knitr::kable(train_accuracies)
.model.typeMERMSEMAEMPEMAPEMASERMSSEACF1
etsTraining-77.5990212891.8919824.778-20.07396552.204560.99348900.99482100.5352087
batsTraining1768.395198540.0886105.791-2.81683127.187030.61742220.65900800.1656173
tbatsTraining1653.485817955.4115577.862-3.00326026.367440.56403760.61389060.0367109
test_accuracies<- accuracy(forecasts,test)knitr::kable(test_accuracies)
.model.typeMERMSEMAEMPEMAPEMASERMSSEACF1
batsTest-10363.64316253.21010829.331-40.4300443.33877NaNNaN0.4460149
etsTest1061.47310669.9849770.000-36.6323971.41690NaNNaN0.5558575
tbatsTest-1898.5603444.4123208.959-16.8643424.23634NaNNaN0.1667398

As does refitting:

models<- refit(models,pelt )

Of the functionality available in theforecast package, onlyforecast::tbats.components() is missing.

Performance note

Fitting bats/tbats to a few long series can (potentially) be slowerusing this wrapper than using the forecast package. This is due to thefact that the internal tbats/bats algorithm always executes sequentially(i.e. withuse.parallel = FALSE ) to prevent issues with nestedparallelism (as thefabletools::model function is taken to beresponsible for handling parallelization).

This should never be a problem on many time series, but does lead to asignificant slow-down if you are only modelling a single/few timeseries. Nonetheless, in those cases thefasster package might be muchbetter suited for your use case anyways.

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp