Skip to content

Commit

Permalink
(feat): create iowa_forecast/models_configs.pymodule to handle ARIM…
Browse files Browse the repository at this point in the history
…A and ARIMA_PLUS_XREG. models configuration.

* `iowa_forecast/ml_train.py`: create `include_test_on_model_train` and `include_test_on_arima_model_train` functions to determine whether or not 'test data' is used to train the ARIMA and ARIMA_PLUS_XREG models.

* `.github/workflows/test-code.yml`: fix the workflow.

* `pyproject.toml`: include missing dependencies.

* `requirements.txt`: include missing dependencies.

Unit tests
----------

* `tests/test_models_configs.py`: create unit-tests for `models_configs` module.

* `tests/test_utils.py`: create unit-tests for `utils` module.

Minor Changes
---------------

* `notebooks/Walkthrough.ipynb`: minor fixes to the grammar of some markdown cells.

* `docs/`: remove unused .rst files.
  • Loading branch information
erik-ingwersen-ey committed Aug 12, 2024
1 parent 7a4d0c3 commit c390239
Show file tree
Hide file tree
Showing 42 changed files with 11,006 additions and 2,854 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/test-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,29 @@ on:
branches:
- main
- dev
workflow_dispatch:

jobs:
test:

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -32,10 +40,16 @@ jobs:
- name: Run tests
run: |
pytest ./tests
pytest --cov=iowa_forecast --cov-report=xml --cov-report=html tests/
- name: Upload coverage report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ./htmlcov/

- name: Upload coverage report XML
uses: actions/upload-artifact@v4
with:
name: coverage-report-xml
path: coverage.xml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,4 @@ cython_debug/
#.idea/
*.json
/.idea
*.lock
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ EXPOSE 8080
# Define environment variables

# Project ID where the tables and models will be saved to inside BigQuery
ENV PROJECT_ID "iowa-liquor-sales-forecast-v2"
ENV PROJECT_ID "iowa-liquor-sales-forecast-v4"

# Dataset name where the tables and models will be stored to
ENV DATASET_NAME "bqmlforecast"
Expand All @@ -35,4 +35,4 @@ ENV GOOGLE_APPLICATION_CREDENTIALS="/gcloud/application_default_credentials.json


# Run app.py when the container launches
ENTRYPOINT ["python", "pipelines/execute_load_data.py"]
ENTRYPOINT ["python", "pipelines/train_model_and_forecast_sales.py"]
9 changes: 6 additions & 3 deletions docs/api_reference/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
API Reference
==============
=============

This page gives an overview of all public pandas objects, functions and methods.
All functions exposed in `iowa_forecast.*` namespace are public.
Expand All @@ -12,14 +12,17 @@ The `iowa_forecast` package contains the following modules:

* `iowa_forecast.ml_train`: BigQuery Model Training and Execution Module.

* `iowa_forecast.models_configs`: Classes for managing and validating
configuration parameters

* `iowa_forecast.plots`: Time Series Plotting and Date Handling Module.

* `iowa_forecast.utils`: General utility functions Module.

iowa\_forecast
-------------
--------------

.. toctree::
:maxdepth: 2

iowa_forecast/index
iowa_forecast/index
1 change: 1 addition & 0 deletions docs/api_reference/iowa_forecast/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ iowa\_forecast
load_data
ml_eval
ml_train
models_configs
plots
utils
7 changes: 7 additions & 0 deletions docs/api_reference/iowa_forecast/models_configs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
models\_configs
---------------

.. automodule:: iowa_forecast.models_configs
:members:
:undoc-members:
:show-inheritance:
Binary file modified docs/docs/doctrees/api_reference/index.doctree
Binary file not shown.
Binary file modified docs/docs/doctrees/api_reference/iowa_forecast/index.doctree
Binary file not shown.
Binary file not shown.
Binary file modified docs/docs/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/docs/doctrees/installation.doctree
Binary file not shown.
7 changes: 2 additions & 5 deletions docs/docs/html/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
<li class="toctree-l3"><a class="reference internal" href="../api_reference/iowa_forecast/load_data.html">load_data</a></li>
<li class="toctree-l3"><a class="reference internal" href="../api_reference/iowa_forecast/ml_eval.html">ml_eval</a></li>
<li class="toctree-l3"><a class="reference internal" href="../api_reference/iowa_forecast/ml_train.html">ml_train</a></li>
<li class="toctree-l3"><a class="reference internal" href="../api_reference/iowa_forecast/models_configs.html">models_configs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../api_reference/iowa_forecast/plots.html">plots</a></li>
<li class="toctree-l3"><a class="reference internal" href="../api_reference/iowa_forecast/utils.html">utils</a></li>
</ul>
Expand Down Expand Up @@ -248,11 +249,7 @@
</div>
<article role="main" id="furo-main-content">
<h1>All modules for which code is available</h1>
<ul><li><a href="iowa_forecast/load_data.html">iowa_forecast.load_data</a></li>
<li><a href="iowa_forecast/ml_eval.html">iowa_forecast.ml_eval</a></li>
<li><a href="iowa_forecast/ml_train.html">iowa_forecast.ml_train</a></li>
<li><a href="iowa_forecast/plots.html">iowa_forecast.plots</a></li>
<li><a href="iowa_forecast/utils.html">iowa_forecast.utils</a></li>
<ul><li><a href="iowa_forecast/models_configs.html">iowa_forecast.models_configs</a></li>
</ul>
</article>
</div>
Expand Down
17 changes: 16 additions & 1 deletion docs/docs/html/_modules/iowa_forecast/load_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=354aac6f" />
<link rel="stylesheet" type="text/css" href="../../_static/tabs.css?v=4c969af8" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo-extensions.css?v=302659d7" />
<link rel="stylesheet" type="text/css" href="../../_static/custom.css?v=44c88a81" />



Expand Down Expand Up @@ -199,7 +200,21 @@
<div id="searchbox"></div><div class="sidebar-tree">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../iowa_forecast.html">iowa_forecast package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../installation.html">Installation</a></li>
</ul>
<ul>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../api_reference/index.html">API Reference</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle navigation of API Reference</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../api_reference/iowa_forecast/index.html">iowa_forecast</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle navigation of iowa_forecast</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/load_data.html">load_data</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/ml_eval.html">ml_eval</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/ml_train.html">ml_train</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/models_configs.html">models_configs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/plots.html">plots</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/utils.html">utils</a></li>
</ul>
</li>
</ul>
</li>
</ul>

</div>
Expand Down
17 changes: 16 additions & 1 deletion docs/docs/html/_modules/iowa_forecast/ml_train.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=354aac6f" />
<link rel="stylesheet" type="text/css" href="../../_static/tabs.css?v=4c969af8" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo-extensions.css?v=302659d7" />
<link rel="stylesheet" type="text/css" href="../../_static/custom.css?v=44c88a81" />



Expand Down Expand Up @@ -199,7 +200,21 @@
<div id="searchbox"></div><div class="sidebar-tree">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../iowa_forecast.html">iowa_forecast package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../installation.html">Installation</a></li>
</ul>
<ul>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../api_reference/index.html">API Reference</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle navigation of API Reference</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../api_reference/iowa_forecast/index.html">iowa_forecast</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle navigation of iowa_forecast</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/load_data.html">load_data</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/ml_eval.html">ml_eval</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/ml_train.html">ml_train</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/models_configs.html">models_configs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/plots.html">plots</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../api_reference/iowa_forecast/utils.html">utils</a></li>
</ul>
</li>
</ul>
</li>
</ul>

</div>
Expand Down
Loading

0 comments on commit c390239

Please sign in to comment.