-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
76 lines (58 loc) · 1.71 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
warning = FALSE,
message = FALSE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# m5 <img src='man/figures/logo-small.png' align="right" height="139" />
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/m5)](https://CRAN.R-project.org/package=m5)
[![Buy hex
stciker](https://img.shields.io/badge/buy%20hex-m5-green?style=flat&logo=redbubble)](https://www.redbubble.com/i/sticker/m5-R-package-hex-by-krzjoa/122633859.EJUG5)
[![R-CMD-check](https://github.com/krzjoa/m5/workflows/check-standard/badge.svg)](https://github.com/krzjoa/m5/actions)
<!-- badges: end -->
> M5 Walmart Challenge Data
## Installation
You can install the development version of m5 from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("krzjoa/m5")
```
## Usage
```{r}
library(m5)
library(zeallot)
library(ggplot2)
DIR <- 'data'
# Downloading the data
m5_download(DIR)
# Loading the data
c(sales_train,
sales_test,
sell_prices,
calendar,
weights) %<-% m5_get_raw_evaluation(DIR)
# Preparing the data
m5_data <-
m5_prepare(sales_train, sales_test, calendar, sell_prices)
# Demand classification
m5_demand <- m5_demand_type(m5_data)
foods_1_demand <-
m5_demand[startsWith(as.character(m5_demand$item_id), "FOODS_1")]
plot <-
ggplot(foods_1_demand) +
geom_point(aes(log(cv2), log(adi),
item_id = item_id, col = demand_type)) +
geom_hline(yintercept = log(1.32)) +
geom_vline(xintercept = log(0.49)) +
theme_minimal()
plot
```