-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
57 lines (41 loc) · 2.07 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# M4metaresults.lite
M4metaresults.lite is a lightweight version of [m4metaresults](https://github.com/pmontman/M4metaresults) that only includes the trained model file neccessary to use the [M4metalearning](https://github.com/robjhyndman/M4metalearning) model. It does not use lazy loading in order to speed up package installation and fix an install error in docker. As a result it requires explicitly loading the data with `data("model_M4")`, unlike the original package.
Example, taken from the [M4meta reproduction script](https://github.com/robjhyndman/M4metalearning/blob/master/docs/M4_reprod.md):
```{r}
library("M4metalearning")
library("M4metaresults.lite")
data("model_M4")
set.seed(10-06-2018)
truex = (rnorm(60)) + seq(60)/10
#we subtract the last 10 observations to use it as 'true future' values
#and keep the rest as the input series in our method
h = 10
x <- head(truex, -h)
x <- ts(x, frequency = 1)
#forecasting with our method using our pretrained model in one line of code
#just the input series and the desired forecasting horizon
forec_result <- forecast_meta_M4(model_M4, x, h=h)
forec_result
```
## Install
From github:
```{r, eval = FALSE}
library("remotes")
remotes::install_github("andybega/M4metaresults.lite@v0.1.0")
```
## Note on data
Since the data file is 800MB, it is not possible to include it on GitHub except under the release tarball.
By default R's `save()` uses compression. The model file is 800MB in memory, and similar on disk if compression is used. However, this results in atrocious load times. Saving with `save(..., compress = FALSE)` increases the file size on disk to 1.6GB, but the load time decreases from 7s to 2s.
I removed lazy load from the DESCRIPTION file, this skips the respective install portion and make install much faster. The package will in any case only be loaded when needed.