pkiage commited on
Commit
7ab79fb
0 Parent(s):

initial commit

Browse files
.gitignore ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ venv
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ *.py[cod]
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ env/
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+
28
+ # PyInstaller
29
+ # Usually these files are written by a python script from a template
30
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+
48
+ # Translations
49
+ *.mo
50
+ *.pot
51
+
52
+ # Django stuff:
53
+ *.log
54
+
55
+ # Sphinx documentation
56
+ docs/_build/
57
+
58
+ # PyBuilder
59
+ target/
60
+
61
+ # DotEnv configuration
62
+ .env
63
+
64
+ # Database
65
+ *.db
66
+ *.rdb
67
+
68
+ # Pycharm
69
+ .idea
70
+
71
+ # VS Code
72
+ .vscode/
73
+
74
+ # Spyder
75
+ .spyproject/
76
+
77
+ # Jupyter NB Checkpoints
78
+ .ipynb_checkpoints/
79
+
80
+
81
+ # Mac OS-specific storage files
82
+ .DS_Store
83
+
84
+ # vim
85
+ *.swp
86
+ *.swo
87
+
88
+ # Mypy cache
89
+ .mypy_cache/
.slugignore ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ docs
2
+ models
3
+ notebooks
4
+ reports
5
+ README
6
+ Makefile
7
+ test_environment
8
+ venv
9
+
10
+ # Byte-compiled / optimized / DLL files
11
+ __pycache__/
12
+ *.py[cod]
13
+
14
+ # C extensions
15
+ *.so
16
+
17
+ # Distribution / packaging
18
+ .Python
19
+ env/
20
+ build/
21
+ develop-eggs/
22
+ dist/
23
+ downloads/
24
+ eggs/
25
+ .eggs/
26
+ lib/
27
+ lib64/
28
+ parts/
29
+ sdist/
30
+ var/
31
+ *.egg-info/
32
+ .installed.cfg
33
+ *.egg
34
+
35
+ # PyInstaller
36
+ # Usually these files are written by a python script from a template
37
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
38
+ *.manifest
39
+ *.spec
40
+
41
+ # Installer logs
42
+ pip-log.txt
43
+ pip-delete-this-directory.txt
44
+
45
+ # Unit test / coverage reports
46
+ htmlcov/
47
+ .tox/
48
+ .coverage
49
+ .coverage.*
50
+ .cache
51
+ nosetests.xml
52
+ coverage.xml
53
+ *.cover
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+
62
+ # Sphinx documentation
63
+ docs/_build/
64
+
65
+ # PyBuilder
66
+ target/
67
+
68
+ # DotEnv configuration
69
+ .env
70
+
71
+ # Database
72
+ *.db
73
+ *.rdb
74
+
75
+ # Pycharm
76
+ .idea
77
+
78
+ # VS Code
79
+ .vscode/
80
+
81
+ # Spyder
82
+ .spyproject/
83
+
84
+ # Jupyter NB Checkpoints
85
+ .ipynb_checkpoints/
86
+
87
+
88
+ # Mac OS-specific storage files
89
+ .DS_Store
90
+
91
+ # vim
92
+ *.swp
93
+ *.swo
94
+
95
+ # Mypy cache
96
+ .mypy_cache/
LICENSE ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ The MIT License (MIT)
3
+ Copyright (c) 2022, Author
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
+
Procfile ADDED
@@ -0,0 +1 @@
 
 
1
+ web: sh setup.sh && streamlit run src/app.py
README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Time series decomposition tool
2
+
3
+ Tool demonstrating time series decomposition in Python.
4
+
5
+ Assumes uploaded data is clean.
6
+
7
+ ## Built With
8
+
9
+ - [Streamlit](https://streamlit.io/)
10
+
11
+
12
+ ## Local setup
13
+
14
+ ### Obtain the repo locally and open its root folder
15
+
16
+ #### To potentially contribute
17
+
18
+ ```shell
19
+ git clone https://github.com/pkiage/tool-time-series-decomposition-demo
20
+ ```
21
+
22
+ or
23
+
24
+ ```shell
25
+ gh repo clone pkiage/tool-credit-risk-modelling
26
+ ```
27
+
28
+ #### Just to deploy locally
29
+
30
+ Download ZIP
31
+
32
+ ### (optional) Setup virtual environment:
33
+
34
+ ```shell
35
+ python -m venv venv
36
+ ```
37
+
38
+ ### (optional) Activate virtual environment:
39
+
40
+ #### If using Unix based OS run the following in terminal:
41
+
42
+ ```shell
43
+ .\venv\bin\activate
44
+ ```
45
+
46
+ #### If using Windows run the following in terminal:
47
+
48
+ ```shell
49
+ .\venv\Scripts\activate
50
+ ```
51
+
52
+ ### Install requirements by running the following in terminal:
53
+
54
+ #### Required packages
55
+
56
+ ```shell
57
+ pip install -r requirements.txt
58
+ ```
59
+
60
+ ## Build and install local package
61
+
62
+ ```shell
63
+ python setup.py build
64
+ ```
65
+
66
+ ```shell
67
+ python setup.py install
68
+ ```
69
+
70
+ ### Run the streamlit app (app.py) by running the following in terminal (from repository root folder):
71
+
72
+ ```shell
73
+ streamlit run src/app.py
74
+ ```
75
+
76
+
77
+
78
+ <p><small>Project based on the <a target="_blank" href="https://drivendata.github.io/cookiecutter-data-science/">cookiecutter data science project template</a>.</small></p>
79
+
80
+ <p><small>Built with Streamlit</small></p>
data/external/.gitkeep ADDED
File without changes
data/interim/.gitkeep ADDED
File without changes
data/processed/.gitkeep ADDED
File without changes
data/processed/airline.csv ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Month,AirPassengers
2
+ 1949-01-01,112
3
+ 1949-02-01,118
4
+ 1949-03-01,132
5
+ 1949-04-01,129
6
+ 1949-05-01,121
7
+ 1949-06-01,135
8
+ 1949-07-01,148
9
+ 1949-08-01,148
10
+ 1949-09-01,136
11
+ 1949-10-01,119
12
+ 1949-11-01,104
13
+ 1949-12-01,118
14
+ 1950-01-01,115
15
+ 1950-02-01,126
16
+ 1950-03-01,141
17
+ 1950-04-01,135
18
+ 1950-05-01,125
19
+ 1950-06-01,149
20
+ 1950-07-01,170
21
+ 1950-08-01,170
22
+ 1950-09-01,158
23
+ 1950-10-01,133
24
+ 1950-11-01,114
25
+ 1950-12-01,140
26
+ 1951-01-01,145
27
+ 1951-02-01,150
28
+ 1951-03-01,178
29
+ 1951-04-01,163
30
+ 1951-05-01,172
31
+ 1951-06-01,178
32
+ 1951-07-01,199
33
+ 1951-08-01,199
34
+ 1951-09-01,184
35
+ 1951-10-01,162
36
+ 1951-11-01,146
37
+ 1951-12-01,166
38
+ 1952-01-01,171
39
+ 1952-02-01,180
40
+ 1952-03-01,193
41
+ 1952-04-01,181
42
+ 1952-05-01,183
43
+ 1952-06-01,218
44
+ 1952-07-01,230
45
+ 1952-08-01,242
46
+ 1952-09-01,209
47
+ 1952-10-01,191
48
+ 1952-11-01,172
49
+ 1952-12-01,194
50
+ 1953-01-01,196
51
+ 1953-02-01,196
52
+ 1953-03-01,236
53
+ 1953-04-01,235
54
+ 1953-05-01,229
55
+ 1953-06-01,243
56
+ 1953-07-01,264
57
+ 1953-08-01,272
58
+ 1953-09-01,237
59
+ 1953-10-01,211
60
+ 1953-11-01,180
61
+ 1953-12-01,201
62
+ 1954-01-01,204
63
+ 1954-02-01,188
64
+ 1954-03-01,235
65
+ 1954-04-01,227
66
+ 1954-05-01,234
67
+ 1954-06-01,264
68
+ 1954-07-01,302
69
+ 1954-08-01,293
70
+ 1954-09-01,259
71
+ 1954-10-01,229
72
+ 1954-11-01,203
73
+ 1954-12-01,229
74
+ 1955-01-01,242
75
+ 1955-02-01,233
76
+ 1955-03-01,267
77
+ 1955-04-01,269
78
+ 1955-05-01,270
79
+ 1955-06-01,315
80
+ 1955-07-01,364
81
+ 1955-08-01,347
82
+ 1955-09-01,312
83
+ 1955-10-01,274
84
+ 1955-11-01,237
85
+ 1955-12-01,278
86
+ 1956-01-01,284
87
+ 1956-02-01,277
88
+ 1956-03-01,317
89
+ 1956-04-01,313
90
+ 1956-05-01,318
91
+ 1956-06-01,374
92
+ 1956-07-01,413
93
+ 1956-08-01,405
94
+ 1956-09-01,355
95
+ 1956-10-01,306
96
+ 1956-11-01,271
97
+ 1956-12-01,306
98
+ 1957-01-01,315
99
+ 1957-02-01,301
100
+ 1957-03-01,356
101
+ 1957-04-01,348
102
+ 1957-05-01,355
103
+ 1957-06-01,422
104
+ 1957-07-01,465
105
+ 1957-08-01,467
106
+ 1957-09-01,404
107
+ 1957-10-01,347
108
+ 1957-11-01,305
109
+ 1957-12-01,336
110
+ 1958-01-01,340
111
+ 1958-02-01,318
112
+ 1958-03-01,362
113
+ 1958-04-01,348
114
+ 1958-05-01,363
115
+ 1958-06-01,435
116
+ 1958-07-01,491
117
+ 1958-08-01,505
118
+ 1958-09-01,404
119
+ 1958-10-01,359
120
+ 1958-11-01,310
121
+ 1958-12-01,337
122
+ 1959-01-01,360
123
+ 1959-02-01,342
124
+ 1959-03-01,406
125
+ 1959-04-01,396
126
+ 1959-05-01,420
127
+ 1959-06-01,472
128
+ 1959-07-01,548
129
+ 1959-08-01,559
130
+ 1959-09-01,463
131
+ 1959-10-01,407
132
+ 1959-11-01,362
133
+ 1959-12-01,405
134
+ 1960-01-01,417
135
+ 1960-02-01,391
136
+ 1960-03-01,419
137
+ 1960-04-01,461
138
+ 1960-05-01,472
139
+ 1960-06-01,535
140
+ 1960-07-01,622
141
+ 1960-08-01,606
142
+ 1960-09-01,508
143
+ 1960-10-01,461
144
+ 1960-11-01,390
145
+ 1960-12-01,432
data/processed/milk_production.csv ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ date,pounds_per_cow
2
+ 1962-01-01,589.0
3
+ 1962-02-01,561.0
4
+ 1962-03-01,640.0
5
+ 1962-04-01,656.0
6
+ 1962-05-01,727.0
7
+ 1962-06-01,697.0
8
+ 1962-07-01,640.0
9
+ 1962-08-01,599.0
10
+ 1962-09-01,568.0
11
+ 1962-10-01,577.0
12
+ 1962-11-01,553.0
13
+ 1962-12-01,582.0
14
+ 1963-01-01,600.0
15
+ 1963-02-01,566.0
16
+ 1963-03-01,653.0
17
+ 1963-04-01,673.0
18
+ 1963-05-01,742.0
19
+ 1963-06-01,716.0
20
+ 1963-07-01,660.0
21
+ 1963-08-01,617.0
22
+ 1963-09-01,583.0
23
+ 1963-10-01,587.0
24
+ 1963-11-01,565.0
25
+ 1963-12-01,598.0
26
+ 1964-01-01,628.0
27
+ 1964-02-01,618.0
28
+ 1964-03-01,688.0
29
+ 1964-04-01,705.0
30
+ 1964-05-01,770.0
31
+ 1964-06-01,736.0
32
+ 1964-07-01,678.0
33
+ 1964-08-01,639.0
34
+ 1964-09-01,604.0
35
+ 1964-10-01,611.0
36
+ 1964-11-01,594.0
37
+ 1964-12-01,634.0
38
+ 1965-01-01,658.0
39
+ 1965-02-01,622.0
40
+ 1965-03-01,709.0
41
+ 1965-04-01,722.0
42
+ 1965-05-01,782.0
43
+ 1965-06-01,756.0
44
+ 1965-07-01,702.0
45
+ 1965-08-01,653.0
46
+ 1965-09-01,615.0
47
+ 1965-10-01,621.0
48
+ 1965-11-01,602.0
49
+ 1965-12-01,635.0
50
+ 1966-01-01,677.0
51
+ 1966-02-01,635.0
52
+ 1966-03-01,736.0
53
+ 1966-04-01,755.0
54
+ 1966-05-01,811.0
55
+ 1966-06-01,798.0
56
+ 1966-07-01,735.0
57
+ 1966-08-01,697.0
58
+ 1966-09-01,661.0
59
+ 1966-10-01,667.0
60
+ 1966-11-01,645.0
61
+ 1966-12-01,688.0
62
+ 1967-01-01,713.0
63
+ 1967-02-01,667.0
64
+ 1967-03-01,762.0
65
+ 1967-04-01,784.0
66
+ 1967-05-01,837.0
67
+ 1967-06-01,817.0
68
+ 1967-07-01,767.0
69
+ 1967-08-01,722.0
70
+ 1967-09-01,681.0
71
+ 1967-10-01,687.0
72
+ 1967-11-01,660.0
73
+ 1967-12-01,698.0
74
+ 1968-01-01,717.0
75
+ 1968-02-01,696.0
76
+ 1968-03-01,775.0
77
+ 1968-04-01,796.0
78
+ 1968-05-01,858.0
79
+ 1968-06-01,826.0
80
+ 1968-07-01,783.0
81
+ 1968-08-01,740.0
82
+ 1968-09-01,701.0
83
+ 1968-10-01,706.0
84
+ 1968-11-01,677.0
85
+ 1968-12-01,711.0
86
+ 1969-01-01,734.0
87
+ 1969-02-01,690.0
88
+ 1969-03-01,785.0
89
+ 1969-04-01,805.0
90
+ 1969-05-01,871.0
91
+ 1969-06-01,845.0
92
+ 1969-07-01,801.0
93
+ 1969-08-01,764.0
94
+ 1969-09-01,725.0
95
+ 1969-10-01,723.0
96
+ 1969-11-01,690.0
97
+ 1969-12-01,734.0
98
+ 1970-01-01,750.0
99
+ 1970-02-01,707.0
100
+ 1970-03-01,807.0
101
+ 1970-04-01,824.0
102
+ 1970-05-01,886.0
103
+ 1970-06-01,859.0
104
+ 1970-07-01,819.0
105
+ 1970-08-01,783.0
106
+ 1970-09-01,740.0
107
+ 1970-10-01,747.0
108
+ 1970-11-01,711.0
109
+ 1970-12-01,751.0
110
+ 1971-01-01,804.0
111
+ 1971-02-01,756.0
112
+ 1971-03-01,860.0
113
+ 1971-04-01,878.0
114
+ 1971-05-01,942.0
115
+ 1971-06-01,913.0
116
+ 1971-07-01,869.0
117
+ 1971-08-01,834.0
118
+ 1971-09-01,790.0
119
+ 1971-10-01,800.0
120
+ 1971-11-01,763.0
121
+ 1971-12-01,800.0
122
+ 1972-01-01,826.0
123
+ 1972-02-01,799.0
124
+ 1972-03-01,890.0
125
+ 1972-04-01,900.0
126
+ 1972-05-01,961.0
127
+ 1972-06-01,935.0
128
+ 1972-07-01,894.0
129
+ 1972-08-01,855.0
130
+ 1972-09-01,809.0
131
+ 1972-10-01,810.0
132
+ 1972-11-01,766.0
133
+ 1972-12-01,805.0
134
+ 1973-01-01,821.0
135
+ 1973-02-01,773.0
136
+ 1973-03-01,883.0
137
+ 1973-04-01,898.0
138
+ 1973-05-01,957.0
139
+ 1973-06-01,924.0
140
+ 1973-07-01,881.0
141
+ 1973-08-01,837.0
142
+ 1973-09-01,784.0
143
+ 1973-10-01,791.0
144
+ 1973-11-01,760.0
145
+ 1973-12-01,802.0
146
+ 1974-01-01,828.0
147
+ 1974-02-01,778.0
148
+ 1974-03-01,889.0
149
+ 1974-04-01,902.0
150
+ 1974-05-01,969.0
151
+ 1974-06-01,947.0
152
+ 1974-07-01,908.0
153
+ 1974-08-01,867.0
154
+ 1974-09-01,815.0
155
+ 1974-10-01,812.0
156
+ 1974-11-01,773.0
157
+ 1974-12-01,813.0
158
+ 1975-01-01,834.0
159
+ 1975-02-01,782.0
160
+ 1975-03-01,892.0
161
+ 1975-04-01,903.0
162
+ 1975-05-01,966.0
163
+ 1975-06-01,937.0
164
+ 1975-07-01,896.0
165
+ 1975-08-01,858.0
166
+ 1975-09-01,817.0
167
+ 1975-10-01,827.0
168
+ 1975-11-01,797.0
169
+ 1975-12-01,843.0
data/raw/.gitkeep ADDED
File without changes
docs/Makefile ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line.
5
+ SPHINXOPTS =
6
+ SPHINXBUILD = sphinx-build
7
+ PAPER =
8
+ BUILDDIR = _build
9
+
10
+ # Internal variables.
11
+ PAPEROPT_a4 = -D latex_paper_size=a4
12
+ PAPEROPT_letter = -D latex_paper_size=letter
13
+ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
14
+ # the i18n builder cannot share the environment and doctrees with the others
15
+ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
16
+
17
+ .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
18
+
19
+ help:
20
+ @echo "Please use \`make <target>' where <target> is one of"
21
+ @echo " html to make standalone HTML files"
22
+ @echo " dirhtml to make HTML files named index.html in directories"
23
+ @echo " singlehtml to make a single large HTML file"
24
+ @echo " pickle to make pickle files"
25
+ @echo " json to make JSON files"
26
+ @echo " htmlhelp to make HTML files and a HTML help project"
27
+ @echo " qthelp to make HTML files and a qthelp project"
28
+ @echo " devhelp to make HTML files and a Devhelp project"
29
+ @echo " epub to make an epub"
30
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
31
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
32
+ @echo " text to make text files"
33
+ @echo " man to make manual pages"
34
+ @echo " texinfo to make Texinfo files"
35
+ @echo " info to make Texinfo files and run them through makeinfo"
36
+ @echo " gettext to make PO message catalogs"
37
+ @echo " changes to make an overview of all changed/added/deprecated items"
38
+ @echo " linkcheck to check all external links for integrity"
39
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
40
+
41
+ clean:
42
+ -rm -rf $(BUILDDIR)/*
43
+
44
+ html:
45
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
46
+ @echo
47
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
48
+
49
+ dirhtml:
50
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
51
+ @echo
52
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
53
+
54
+ singlehtml:
55
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
56
+ @echo
57
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
58
+
59
+ pickle:
60
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
61
+ @echo
62
+ @echo "Build finished; now you can process the pickle files."
63
+
64
+ json:
65
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
66
+ @echo
67
+ @echo "Build finished; now you can process the JSON files."
68
+
69
+ htmlhelp:
70
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
71
+ @echo
72
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
73
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
74
+
75
+ qthelp:
76
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
77
+ @echo
78
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
79
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
80
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/tool-time-series-decomposition.qhcp"
81
+ @echo "To view the help file:"
82
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/tool-time-series-decomposition.qhc"
83
+
84
+ devhelp:
85
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
86
+ @echo
87
+ @echo "Build finished."
88
+ @echo "To view the help file:"
89
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/tool-time-series-decomposition"
90
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/tool-time-series-decomposition"
91
+ @echo "# devhelp"
92
+
93
+ epub:
94
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
95
+ @echo
96
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
97
+
98
+ latex:
99
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
100
+ @echo
101
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
102
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
103
+ "(use \`make latexpdf' here to do that automatically)."
104
+
105
+ latexpdf:
106
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
107
+ @echo "Running LaTeX files through pdflatex..."
108
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
109
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
110
+
111
+ text:
112
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
113
+ @echo
114
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
115
+
116
+ man:
117
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
118
+ @echo
119
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
120
+
121
+ texinfo:
122
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
123
+ @echo
124
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
125
+ @echo "Run \`make' in that directory to run these through makeinfo" \
126
+ "(use \`make info' here to do that automatically)."
127
+
128
+ info:
129
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
130
+ @echo "Running Texinfo files through makeinfo..."
131
+ make -C $(BUILDDIR)/texinfo info
132
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
133
+
134
+ gettext:
135
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
136
+ @echo
137
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
138
+
139
+ changes:
140
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
141
+ @echo
142
+ @echo "The overview file is in $(BUILDDIR)/changes."
143
+
144
+ linkcheck:
145
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
146
+ @echo
147
+ @echo "Link check complete; look for any errors in the above output " \
148
+ "or in $(BUILDDIR)/linkcheck/output.txt."
149
+
150
+ doctest:
151
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
152
+ @echo "Testing of doctests in the sources finished, look at the " \
153
+ "results in $(BUILDDIR)/doctest/output.txt."
docs/commands.rst ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ Commands
2
+ ========
3
+
4
+ The Makefile contains the central entry points for common tasks related to this project.
5
+
6
+ Syncing data to S3
7
+ ^^^^^^^^^^^^^^^^^^
8
+
9
+ * `make sync_data_to_s3` will use `aws s3 sync` to recursively sync files in `data/` up to `s3://[OPTIONAL] your-bucket-for-syncing-data (do not include 's3://')/data/`.
10
+ * `make sync_data_from_s3` will use `aws s3 sync` to recursively sync files from `s3://[OPTIONAL] your-bucket-for-syncing-data (do not include 's3://')/data/` to `data/`.
docs/conf.py ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # tool-time-series-decomposition documentation build configuration file, created by
4
+ # sphinx-quickstart.
5
+ #
6
+ # This file is execfile()d with the current directory set to its containing dir.
7
+ #
8
+ # Note that not all possible configuration values are present in this
9
+ # autogenerated file.
10
+ #
11
+ # All configuration values have a default; values that are commented out
12
+ # serve to show the default.
13
+
14
+ import os
15
+ import sys
16
+
17
+ # If extensions (or modules to document with autodoc) are in another directory,
18
+ # add these directories to sys.path here. If the directory is relative to the
19
+ # documentation root, use os.path.abspath to make it absolute, like shown here.
20
+ # sys.path.insert(0, os.path.abspath('.'))
21
+
22
+ # -- General configuration -----------------------------------------------------
23
+
24
+ # If your documentation needs a minimal Sphinx version, state it here.
25
+ # needs_sphinx = '1.0'
26
+
27
+ # Add any Sphinx extension module names here, as strings. They can be extensions
28
+ # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
29
+ extensions = []
30
+
31
+ # Add any paths that contain templates here, relative to this directory.
32
+ templates_path = ['_templates']
33
+
34
+ # The suffix of source filenames.
35
+ source_suffix = '.rst'
36
+
37
+ # The encoding of source files.
38
+ # source_encoding = 'utf-8-sig'
39
+
40
+ # The master toctree document.
41
+ master_doc = 'index'
42
+
43
+ # General information about the project.
44
+ project = u'tool-time-series-decomposition'
45
+
46
+ # The version info for the project you're documenting, acts as replacement for
47
+ # |version| and |release|, also used in various other places throughout the
48
+ # built documents.
49
+ #
50
+ # The short X.Y version.
51
+ version = '0.1'
52
+ # The full version, including alpha/beta/rc tags.
53
+ release = '0.1'
54
+
55
+ # The language for content autogenerated by Sphinx. Refer to documentation
56
+ # for a list of supported languages.
57
+ # language = None
58
+
59
+ # There are two options for replacing |today|: either, you set today to some
60
+ # non-false value, then it is used:
61
+ # today = ''
62
+ # Else, today_fmt is used as the format for a strftime call.
63
+ # today_fmt = '%B %d, %Y'
64
+
65
+ # List of patterns, relative to source directory, that match files and
66
+ # directories to ignore when looking for source files.
67
+ exclude_patterns = ['_build']
68
+
69
+ # The reST default role (used for this markup: `text`) to use for all documents.
70
+ # default_role = None
71
+
72
+ # If true, '()' will be appended to :func: etc. cross-reference text.
73
+ # add_function_parentheses = True
74
+
75
+ # If true, the current module name will be prepended to all description
76
+ # unit titles (such as .. function::).
77
+ # add_module_names = True
78
+
79
+ # If true, sectionauthor and moduleauthor directives will be shown in the
80
+ # output. They are ignored by default.
81
+ # show_authors = False
82
+
83
+ # The name of the Pygments (syntax highlighting) style to use.
84
+ pygments_style = 'sphinx'
85
+
86
+ # A list of ignored prefixes for module index sorting.
87
+ # modindex_common_prefix = []
88
+
89
+
90
+ # -- Options for HTML output ---------------------------------------------------
91
+
92
+ # The theme to use for HTML and HTML Help pages. See the documentation for
93
+ # a list of builtin themes.
94
+ html_theme = 'default'
95
+
96
+ # Theme options are theme-specific and customize the look and feel of a theme
97
+ # further. For a list of options available for each theme, see the
98
+ # documentation.
99
+ # html_theme_options = {}
100
+
101
+ # Add any paths that contain custom themes here, relative to this directory.
102
+ # html_theme_path = []
103
+
104
+ # The name for this set of Sphinx documents. If None, it defaults to
105
+ # "<project> v<release> documentation".
106
+ # html_title = None
107
+
108
+ # A shorter title for the navigation bar. Default is the same as html_title.
109
+ # html_short_title = None
110
+
111
+ # The name of an image file (relative to this directory) to place at the top
112
+ # of the sidebar.
113
+ # html_logo = None
114
+
115
+ # The name of an image file (within the static path) to use as favicon of the
116
+ # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
117
+ # pixels large.
118
+ # html_favicon = None
119
+
120
+ # Add any paths that contain custom static files (such as style sheets) here,
121
+ # relative to this directory. They are copied after the builtin static files,
122
+ # so a file named "default.css" will overwrite the builtin "default.css".
123
+ html_static_path = ['_static']
124
+
125
+ # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
126
+ # using the given strftime format.
127
+ # html_last_updated_fmt = '%b %d, %Y'
128
+
129
+ # If true, SmartyPants will be used to convert quotes and dashes to
130
+ # typographically correct entities.
131
+ # html_use_smartypants = True
132
+
133
+ # Custom sidebar templates, maps document names to template names.
134
+ # html_sidebars = {}
135
+
136
+ # Additional templates that should be rendered to pages, maps page names to
137
+ # template names.
138
+ # html_additional_pages = {}
139
+
140
+ # If false, no module index is generated.
141
+ # html_domain_indices = True
142
+
143
+ # If false, no index is generated.
144
+ # html_use_index = True
145
+
146
+ # If true, the index is split into individual pages for each letter.
147
+ # html_split_index = False
148
+
149
+ # If true, links to the reST sources are added to the pages.
150
+ # html_show_sourcelink = True
151
+
152
+ # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
153
+ # html_show_sphinx = True
154
+
155
+ # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
156
+ # html_show_copyright = True
157
+
158
+ # If true, an OpenSearch description file will be output, and all pages will
159
+ # contain a <link> tag referring to it. The value of this option must be the
160
+ # base URL from which the finished HTML is served.
161
+ # html_use_opensearch = ''
162
+
163
+ # This is the file name suffix for HTML files (e.g. ".xhtml").
164
+ # html_file_suffix = None
165
+
166
+ # Output file base name for HTML help builder.
167
+ htmlhelp_basename = 'tool-time-series-decompositiondoc'
168
+
169
+
170
+ # -- Options for LaTeX output --------------------------------------------------
171
+
172
+ latex_elements = {
173
+ # The paper size ('letterpaper' or 'a4paper').
174
+ # 'papersize': 'letterpaper',
175
+
176
+ # The font size ('10pt', '11pt' or '12pt').
177
+ # 'pointsize': '10pt',
178
+
179
+ # Additional stuff for the LaTeX preamble.
180
+ # 'preamble': '',
181
+ }
182
+
183
+ # Grouping the document tree into LaTeX files. List of tuples
184
+ # (source start file, target name, title, author, documentclass [howto/manual]).
185
+ latex_documents = [
186
+ ('index',
187
+ 'tool-time-series-decomposition.tex',
188
+ u'tool-time-series-decomposition Documentation',
189
+ u"Author", 'manual'),
190
+ ]
191
+
192
+ # The name of an image file (relative to this directory) to place at the top of
193
+ # the title page.
194
+ # latex_logo = None
195
+
196
+ # For "manual" documents, if this is true, then toplevel headings are parts,
197
+ # not chapters.
198
+ # latex_use_parts = False
199
+
200
+ # If true, show page references after internal links.
201
+ # latex_show_pagerefs = False
202
+
203
+ # If true, show URL addresses after external links.
204
+ # latex_show_urls = False
205
+
206
+ # Documents to append as an appendix to all manuals.
207
+ # latex_appendices = []
208
+
209
+ # If false, no module index is generated.
210
+ # latex_domain_indices = True
211
+
212
+
213
+ # -- Options for manual page output --------------------------------------------
214
+
215
+ # One entry per manual page. List of tuples
216
+ # (source start file, name, description, authors, manual section).
217
+ man_pages = [
218
+ ('index', 'tool-time-series-decomposition', u'tool-time-series-decomposition Documentation',
219
+ [u"Author"], 1)
220
+ ]
221
+
222
+ # If true, show URL addresses after external links.
223
+ # man_show_urls = False
224
+
225
+
226
+ # -- Options for Texinfo output ------------------------------------------------
227
+
228
+ # Grouping the document tree into Texinfo files. List of tuples
229
+ # (source start file, target name, title, author,
230
+ # dir menu entry, description, category)
231
+ texinfo_documents = [
232
+ ('index', 'tool-time-series-decomposition', u'tool-time-series-decomposition Documentation',
233
+ u"Author", 'tool-time-series-decomposition',
234
+ 'Tool demonstrating time series decomposition in Python.', 'Miscellaneous'),
235
+ ]
236
+
237
+ # Documents to append as an appendix to all manuals.
238
+ # texinfo_appendices = []
239
+
240
+ # If false, no module index is generated.
241
+ # texinfo_domain_indices = True
242
+
243
+ # How to display URL addresses: 'footnote', 'no', or 'inline'.
244
+ # texinfo_show_urls = 'footnote'
docs/getting-started.rst ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Getting started
2
+ ===============
3
+
4
+ This is where you describe how to get set up on a clean install, including the
5
+ commands necessary to get the raw data (using the `sync_data_from_s3` command,
6
+ for example), and then how to make the cleaned, final data sets.
docs/index.rst ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .. tool-time-series-decomposition documentation master file, created by
2
+ sphinx-quickstart.
3
+ You can adapt this file completely to your liking, but it should at least
4
+ contain the root `toctree` directive.
5
+
6
+ tool-time-series-decomposition documentation!
7
+ ==============================================
8
+
9
+ Contents:
10
+
11
+ .. toctree::
12
+ :maxdepth: 2
13
+
14
+ getting-started
15
+ commands
16
+
17
+
18
+
19
+ Indices and tables
20
+ ==================
21
+
22
+ * :ref:`genindex`
23
+ * :ref:`modindex`
24
+ * :ref:`search`
docs/make.bat ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @ECHO OFF
2
+
3
+ REM Command file for Sphinx documentation
4
+
5
+ if "%SPHINXBUILD%" == "" (
6
+ set SPHINXBUILD=sphinx-build
7
+ )
8
+ set BUILDDIR=_build
9
+ set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
10
+ set I18NSPHINXOPTS=%SPHINXOPTS% .
11
+ if NOT "%PAPER%" == "" (
12
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
13
+ set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
14
+ )
15
+
16
+ if "%1" == "" goto help
17
+
18
+ if "%1" == "help" (
19
+ :help
20
+ echo.Please use `make ^<target^>` where ^<target^> is one of
21
+ echo. html to make standalone HTML files
22
+ echo. dirhtml to make HTML files named index.html in directories
23
+ echo. singlehtml to make a single large HTML file
24
+ echo. pickle to make pickle files
25
+ echo. json to make JSON files
26
+ echo. htmlhelp to make HTML files and a HTML help project
27
+ echo. qthelp to make HTML files and a qthelp project
28
+ echo. devhelp to make HTML files and a Devhelp project
29
+ echo. epub to make an epub
30
+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
31
+ echo. text to make text files
32
+ echo. man to make manual pages
33
+ echo. texinfo to make Texinfo files
34
+ echo. gettext to make PO message catalogs
35
+ echo. changes to make an overview over all changed/added/deprecated items
36
+ echo. linkcheck to check all external links for integrity
37
+ echo. doctest to run all doctests embedded in the documentation if enabled
38
+ goto end
39
+ )
40
+
41
+ if "%1" == "clean" (
42
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
43
+ del /q /s %BUILDDIR%\*
44
+ goto end
45
+ )
46
+
47
+ if "%1" == "html" (
48
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
49
+ if errorlevel 1 exit /b 1
50
+ echo.
51
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
52
+ goto end
53
+ )
54
+
55
+ if "%1" == "dirhtml" (
56
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
57
+ if errorlevel 1 exit /b 1
58
+ echo.
59
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
60
+ goto end
61
+ )
62
+
63
+ if "%1" == "singlehtml" (
64
+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
65
+ if errorlevel 1 exit /b 1
66
+ echo.
67
+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
68
+ goto end
69
+ )
70
+
71
+ if "%1" == "pickle" (
72
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
73
+ if errorlevel 1 exit /b 1
74
+ echo.
75
+ echo.Build finished; now you can process the pickle files.
76
+ goto end
77
+ )
78
+
79
+ if "%1" == "json" (
80
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
81
+ if errorlevel 1 exit /b 1
82
+ echo.
83
+ echo.Build finished; now you can process the JSON files.
84
+ goto end
85
+ )
86
+
87
+ if "%1" == "htmlhelp" (
88
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
89
+ if errorlevel 1 exit /b 1
90
+ echo.
91
+ echo.Build finished; now you can run HTML Help Workshop with the ^
92
+ .hhp project file in %BUILDDIR%/htmlhelp.
93
+ goto end
94
+ )
95
+
96
+ if "%1" == "qthelp" (
97
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
98
+ if errorlevel 1 exit /b 1
99
+ echo.
100
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
101
+ .qhcp project file in %BUILDDIR%/qthelp, like this:
102
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\tool-time-series-decomposition.qhcp
103
+ echo.To view the help file:
104
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\tool-time-series-decomposition.ghc
105
+ goto end
106
+ )
107
+
108
+ if "%1" == "devhelp" (
109
+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
110
+ if errorlevel 1 exit /b 1
111
+ echo.
112
+ echo.Build finished.
113
+ goto end
114
+ )
115
+
116
+ if "%1" == "epub" (
117
+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
118
+ if errorlevel 1 exit /b 1
119
+ echo.
120
+ echo.Build finished. The epub file is in %BUILDDIR%/epub.
121
+ goto end
122
+ )
123
+
124
+ if "%1" == "latex" (
125
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
126
+ if errorlevel 1 exit /b 1
127
+ echo.
128
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
129
+ goto end
130
+ )
131
+
132
+ if "%1" == "text" (
133
+ %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
134
+ if errorlevel 1 exit /b 1
135
+ echo.
136
+ echo.Build finished. The text files are in %BUILDDIR%/text.
137
+ goto end
138
+ )
139
+
140
+ if "%1" == "man" (
141
+ %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
142
+ if errorlevel 1 exit /b 1
143
+ echo.
144
+ echo.Build finished. The manual pages are in %BUILDDIR%/man.
145
+ goto end
146
+ )
147
+
148
+ if "%1" == "texinfo" (
149
+ %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
150
+ if errorlevel 1 exit /b 1
151
+ echo.
152
+ echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
153
+ goto end
154
+ )
155
+
156
+ if "%1" == "gettext" (
157
+ %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
158
+ if errorlevel 1 exit /b 1
159
+ echo.
160
+ echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
161
+ goto end
162
+ )
163
+
164
+ if "%1" == "changes" (
165
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
166
+ if errorlevel 1 exit /b 1
167
+ echo.
168
+ echo.The overview file is in %BUILDDIR%/changes.
169
+ goto end
170
+ )
171
+
172
+ if "%1" == "linkcheck" (
173
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
174
+ if errorlevel 1 exit /b 1
175
+ echo.
176
+ echo.Link check complete; look for any errors in the above output ^
177
+ or in %BUILDDIR%/linkcheck/output.txt.
178
+ goto end
179
+ )
180
+
181
+ if "%1" == "doctest" (
182
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
183
+ if errorlevel 1 exit /b 1
184
+ echo.
185
+ echo.Testing of doctests in the sources finished, look at the ^
186
+ results in %BUILDDIR%/doctest/output.txt.
187
+ goto end
188
+ )
189
+
190
+ :end
models/.gitkeep ADDED
File without changes
notebooks/.gitkeep ADDED
File without changes
references/.gitkeep ADDED
File without changes
references/References.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # References
2
+ [Decomposition of Time Series](https://en.wikipedia.org/wiki/Decomposition_of_time_series)
3
+
4
+ [Forecasting Principles and Practice - Residuals](https://otexts.com/fpp2/residuals.html)
5
+
6
+ [Forecasting Principles and Practice - Time Series Components](https://otexts.com/fpp2/components.html)
7
+
8
+ [How to Decompose Time Series Data into Trend and Seasonality](https://machinelearningmastery.com/decompose-time-series-data-trend-seasonality/)
9
+
10
+ [NIST Engineering Statistics Handbook](https://www.itl.nist.gov/div898/handbook/pmc/section4/pmc443.htm)
11
+
12
+ [Secular variation](https://en.wikipedia.org/wiki/Secular_variation)
13
+
14
+ [statsmodels.tsa.seasonal.DecomposeResult](https://www.statsmodels.org/dev/generated/statsmodels.tsa.seasonal.DecomposeResult.html#statsmodels.tsa.seasonal.DecomposeResult)
15
+
reports/.gitkeep ADDED
File without changes
reports/figures/.gitkeep ADDED
File without changes
requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # local package
2
+ -e .
3
+
4
+ # external requirements
5
+ streamlit==1.9.2
6
+ pandas==1.4.2
7
+ statsmodels==0.13.2
8
+ plotly==5.8.0
setup.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from setuptools import find_packages, setup
2
+
3
+ setup(
4
+ name='src',
5
+ packages=find_packages(),
6
+ version='0.1.0',
7
+ description='Tool demonstrating time series decomposition in Python.',
8
+ author='Author',
9
+ license='MIT',
10
+ )
setup.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ mkdir -p ~/.streamlit/
2
+
3
+ cat << EOF > ~/.streamlit/credentials.toml
4
+ [general]
5
+ email = "paul.r.kiage@gmail.com"
6
+ EOF
7
+
8
+ cat << EOF > ~/.streamlit/config.toml
9
+ [server]
10
+ headless = true
11
+ enableCORS = true
12
+ port = $PORT
13
+ EOF
src/__init__.py ADDED
File without changes
src/app.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ from data.utils import *
4
+ from visualization.visualize import *
5
+ from features.build_features import *
6
+
7
+ import os
8
+
9
+
10
+ def main():
11
+
12
+ st.title("Time Series Decomposition Demo")
13
+
14
+ st.header("Data")
15
+
16
+ sample_data_selected = st.selectbox(
17
+ 'Select sample data:', data_set_options)
18
+
19
+ data = import_sample_data(sample_data_selected, data_set_options)
20
+
21
+ show_inputted_dataframe(data)
22
+
23
+ time_series_line_and_box(data)
24
+
25
+ st.header("Time series decomposition")
26
+
27
+ decomposition = decompose_time_series(data)
28
+
29
+ standard_decomposition_plot(decomposition)
30
+
31
+ [trend, seasonal, residual] = extract_trend_seasonal_resid(decomposition)
32
+
33
+ with st.expander("Trend Plot"):
34
+ st.write('The trend component of the data series.')
35
+ st.write('Trend: secular variation(long-term, non-periodic variation)')
36
+
37
+ time_series_line_plot(trend)
38
+
39
+ with st.expander("Seasonality Plot"):
40
+ st.write('The seasonal component of the data series.')
41
+ st.write(
42
+ 'Seasonality: Periodic fluctuations (often at short-term intervals less than a year).')
43
+ time_series_line_plot(seasonal)
44
+
45
+ with st.expander("Residual Plot"):
46
+ st.write('The residual component of the data series.')
47
+ st.write('Residual: What remains after the other components have been removed (describes random, irregular influences).')
48
+ st.write(f'Residual mean: {residual.mean():.4f}')
49
+ time_series_scatter_plot(residual)
50
+
51
+
52
+ if __name__ == "__main__":
53
+ main()
src/data/utils.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ data_set_options = [
3
+ 'Airline',
4
+ 'Milk production'
5
+ ]
6
+
7
+ sample_or_upload_options = [
8
+ 'Use sample data',
9
+ 'Upload data'
10
+ ]
11
+
12
+
13
+ def import_sample_data(sample_data_selected, data_set_options):
14
+ if sample_data_selected == data_set_options[0]:
15
+ data = pd.read_csv('data/processed/airline.csv',
16
+ parse_dates=['Month'], index_col='Month')
17
+
18
+ if sample_data_selected == data_set_options[1]:
19
+ data = pd.read_csv('data/processed/milk_production.csv',
20
+ parse_dates=['date'], index_col='date')
21
+
22
+ return data
src/features/build_features.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import statsmodels.api as sm
2
+ import pandas as pd
3
+
4
+
5
+ def decompose_time_series(data):
6
+ return sm.tsa.seasonal_decompose(data)
7
+
8
+
9
+ def extract_trend_seasonal_resid(decomposition):
10
+ trend = decomposition.trend
11
+ seasonal = decomposition.seasonal
12
+ residual = decomposition.resid
13
+
14
+ return [trend, seasonal, residual]
15
+
16
+
17
+ def create_trend_seasonal_df(trend, seasonal):
18
+ frame = {'Trend': trend, 'Seasonal': seasonal}
19
+ return pd.DataFrame(frame)
src/visualization/.gitkeep ADDED
File without changes
src/visualization/__init__.py ADDED
File without changes
src/visualization/visualize.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import streamlit as st
3
+ import plotly.express as px
4
+
5
+
6
+ def streamlit_2columns_metrics_df_shape(df: pd.DataFrame):
7
+ (
8
+ column1name,
9
+ column2name,
10
+ ) = st.columns(2)
11
+
12
+ with column1name:
13
+ st.metric(
14
+ label="Rows",
15
+ value=df.shape[0],
16
+ delta=None,
17
+ delta_color="normal",
18
+ )
19
+
20
+ with column2name:
21
+ st.metric(
22
+ label="Columns",
23
+ value=df.shape[1],
24
+ delta=None,
25
+ delta_color="normal",
26
+ )
27
+
28
+
29
+ def show_inputted_dataframe(data):
30
+ with st.expander("Input Dataframe (X and y)"):
31
+ st.dataframe(data)
32
+ streamlit_2columns_metrics_df_shape(data)
33
+
34
+
35
+ def standard_decomposition_plot(decomposition):
36
+
37
+ fig = decomposition.plot()
38
+
39
+ (xsize_standard_decomp, ysize_standard_decomp) = streamlit_chart_setting_height_width(
40
+ "Chart Settings", 5, 5, "xsize_standard_decomp", "ysize_standard_decomp")
41
+
42
+ fig.set_size_inches(xsize_standard_decomp, ysize_standard_decomp)
43
+
44
+ st.pyplot(fig)
45
+
46
+
47
+ def time_series_line_plot(data):
48
+ fig = px.line(
49
+ data
50
+ )
51
+ st.plotly_chart(fig)
52
+
53
+
54
+ def time_series_scatter_plot(data):
55
+ fig = px.scatter(
56
+ data
57
+ )
58
+ st.plotly_chart(fig)
59
+
60
+
61
+ def time_series_box_plot(data):
62
+ fig = px.box(data, points="all")
63
+ st.plotly_chart(fig)
64
+
65
+
66
+ def time_series_line_and_box(data):
67
+
68
+ with st.expander("Line plot"):
69
+ time_series_line_plot(data)
70
+
71
+ with st.expander("Box plot"):
72
+ time_series_box_plot(data)
73
+
74
+
75
+ def streamlit_chart_setting_height_width(
76
+ title: str,
77
+ default_widthvalue: int,
78
+ default_heightvalue: int,
79
+ widthkey: str,
80
+ heightkey: str,
81
+ ):
82
+ with st.expander(title):
83
+
84
+ lbarx_col, lbary_col = st.columns(2)
85
+
86
+ with lbarx_col:
87
+ width_size = st.number_input(
88
+ label="Width in inches:",
89
+ value=default_widthvalue,
90
+ key=widthkey,
91
+ )
92
+
93
+ with lbary_col:
94
+ height_size = st.number_input(
95
+ label="Height in inches:",
96
+ value=default_heightvalue,
97
+ key=heightkey,
98
+ )
99
+ return width_size, height_size
test_environment.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+
3
+ REQUIRED_PYTHON = "python3"
4
+
5
+
6
+ def main():
7
+ system_major = sys.version_info.major
8
+ if REQUIRED_PYTHON == "python":
9
+ required_major = 2
10
+ elif REQUIRED_PYTHON == "python3":
11
+ required_major = 3
12
+ else:
13
+ raise ValueError("Unrecognized python interpreter: {}".format(
14
+ REQUIRED_PYTHON))
15
+
16
+ if system_major != required_major:
17
+ raise TypeError(
18
+ "This project requires Python {}. Found: Python {}".format(
19
+ required_major, sys.version))
20
+ else:
21
+ print(">>> Development environment passes all tests!")
22
+
23
+
24
+ if __name__ == '__main__':
25
+ main()
tox.ini ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [flake8]
2
+ max-line-length = 79
3
+ max-complexity = 10