-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mlflow_docs' of github.com:Nixtla/statsforecast into ml…
…flow_docs
- Loading branch information
Showing
88 changed files
with
608,439 additions
and
55,011 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: "build-docs" | ||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
- uses: actions/setup-python@v4 | ||
with: | ||
cache: "pip" | ||
python-version: '3.10' | ||
cache-dependency-path: settings.ini | ||
- name: Build docs | ||
run: | | ||
set -ux | ||
python -m pip install --upgrade pip | ||
pip install -Uq nbdev | ||
pip install -e ".[dev]" | ||
mkdir nbs/_extensions | ||
cp -r docs-scripts/mintlify/ nbs/_extensions/ | ||
python docs-scripts/update-quarto.py | ||
echo "procs = nbdev_plotly.plotly:PlotlyProc" >> settings.ini | ||
nbdev_docs | ||
- name: Apply final formats | ||
run: bash ./docs-scripts/docs-final-formatting.bash | ||
- name: Copy over necessary assets | ||
run: | | ||
cp nbs/mint.json _docs/mint.json | ||
cp docs-scripts/imgs/* _docs/ | ||
- name: Deploy to Mintlify Docs | ||
if: github.event_name == 'push' | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_branch: docs | ||
publish_dir: ./_docs | ||
# The following lines assign commit authorship to the official GH-Actions bot for deploys to `docs` branch. | ||
# You can swap them out with your own user credentials. | ||
user_name: github-actions[bot] | ||
user_email: 41898282+github-actions[bot]@users.noreply.github.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "docs-scripts"] | ||
path = docs-scripts | ||
url = [email protected]:Nixtla/docs.git | ||
branch = scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import numpy as np | ||
import pandas as pd | ||
import pytest | ||
|
||
from statsforecast.utils import generate_series | ||
|
||
|
||
@pytest.fixture | ||
def n_series(): | ||
return 2 | ||
|
||
@pytest.fixture | ||
def horizon(): | ||
return 7 | ||
|
||
@pytest.fixture() | ||
def local_data(n_series, horizon): | ||
n_static = 2 | ||
series = generate_series(n_series, n_static_features=n_static) | ||
static_features = [] | ||
for i in range(n_static): | ||
name = f'static_{i}' | ||
series[name] = series[name].astype(int) | ||
static_features.append(name) | ||
series['unique_id'] = series['unique_id'].astype(str) | ||
uids = series['unique_id'].unique() | ||
static_values = series.groupby('unique_id')[static_features].head(1) | ||
static_values['unique_id'] = uids | ||
last_train_dates = series.groupby('unique_id')['ds'].max() | ||
pred_start = last_train_dates + pd.offsets.Day() | ||
pred_end = last_train_dates + horizon * pd.offsets.Day() | ||
pred_dates = np.hstack([pd.date_range(start, end) for start, end in zip(pred_start, pred_end)]) | ||
X_df = pd.DataFrame( | ||
{ | ||
'unique_id': np.repeat(uids, horizon), | ||
'ds': pred_dates, | ||
} | ||
) | ||
X_df = X_df.merge(static_values, on='unique_id') | ||
return series, X_df |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
import dask.dataframe as dd | ||
import pytest | ||
|
||
from statsforecast.utils import generate_series | ||
from .utils import pipeline, pipeline_with_level | ||
|
||
@pytest.fixture() | ||
def n_series(): | ||
return 2 | ||
|
||
def to_distributed(df): | ||
return dd.from_pandas(df, npartitions=2) | ||
|
||
@pytest.fixture() | ||
def sample_data(n_series): | ||
series = generate_series(n_series).reset_index() | ||
series['unique_id'] = series['unique_id'].astype(str) | ||
series = dd.from_pandas(series, npartitions=2) | ||
return series | ||
def sample_data(local_data): | ||
series, X_df = local_data | ||
return to_distributed(series), to_distributed(X_df) | ||
|
||
def test_dask_flow(sample_data, n_series): | ||
horizon = 7 | ||
pipeline(sample_data, n_series, horizon) | ||
def test_dask_flow(horizon, sample_data, n_series): | ||
pipeline(*sample_data, n_series, horizon) | ||
|
||
def test_dask_flow_with_level(sample_data, n_series): | ||
horizon = 7 | ||
pipeline_with_level(sample_data, n_series, horizon) | ||
def test_dask_flow_with_level(horizon, sample_data, n_series): | ||
pipeline_with_level(*sample_data, n_series, horizon) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
import sys | ||
|
||
import pytest | ||
import ray | ||
|
||
from statsforecast.utils import generate_series | ||
from .utils import pipeline, pipeline_with_level | ||
|
||
@pytest.fixture() | ||
def n_series(): | ||
return 2 | ||
|
||
def to_distributed(df): | ||
return ray.data.from_pandas(df).repartition(2) | ||
|
||
@pytest.fixture() | ||
def sample_data(n_series): | ||
series = generate_series(n_series).reset_index() | ||
series['unique_id'] = series['unique_id'].astype(str) | ||
series = ray.data.from_pandas(series).repartition(2) | ||
return series | ||
def sample_data(local_data): | ||
series, X_df = local_data | ||
return to_distributed(series), to_distributed(X_df) | ||
|
||
def test_ray_flow(sample_data, n_series): | ||
horizon = 7 | ||
pipeline(sample_data, n_series, horizon) | ||
@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python >= 3.8") | ||
def test_ray_flow(horizon, sample_data, n_series): | ||
pipeline(*sample_data, n_series, horizon) | ||
|
||
def test_ray_flow_with_level(sample_data, n_series): | ||
horizon = 7 | ||
pipeline_with_level(sample_data, n_series, horizon) | ||
@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python >= 3.8") | ||
def test_ray_flow_with_level(horizon, sample_data, n_series): | ||
pipeline_with_level(*sample_data, n_series, horizon) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
import sys | ||
|
||
import pytest | ||
from pyspark.sql import SparkSession | ||
|
||
from statsforecast.utils import generate_series | ||
from .utils import pipeline, pipeline_with_level | ||
|
||
@pytest.fixture() | ||
def n_series(): | ||
return 2 | ||
|
||
@pytest.fixture | ||
def spark(): | ||
return SparkSession.builder.getOrCreate() | ||
|
||
def to_distributed(spark, df): | ||
return spark.createDataFrame(df).repartition(2, 'unique_id') | ||
|
||
@pytest.fixture() | ||
def sample_data(n_series): | ||
n_series = 2 | ||
series = generate_series(n_series).reset_index() | ||
series['unique_id'] = series['unique_id'].astype(str) | ||
spark = SparkSession.builder.getOrCreate() | ||
series = spark.createDataFrame(series).repartition(2, 'unique_id') | ||
return series | ||
|
||
def test_spark_flow(sample_data, n_series): | ||
horizon = 7 | ||
pipeline(sample_data, n_series, horizon) | ||
|
||
def test_spark_flow_with_level(sample_data, n_series): | ||
horizon = 7 | ||
pipeline_with_level(sample_data, n_series, horizon) | ||
def sample_data(spark, local_data): | ||
series, X_df = local_data | ||
return to_distributed(spark, series), to_distributed(spark, X_df) | ||
|
||
@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python >= 3.8") | ||
def test_spark_flow(horizon, sample_data, n_series): | ||
pipeline(*sample_data, n_series, horizon) | ||
|
||
@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python >= 3.8") | ||
def test_spark_flow_with_level(horizon, sample_data, n_series): | ||
pipeline_with_level(*sample_data, n_series, horizon) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
holidays<0.21 | ||
holidays<0.21 | ||
jupyterlab | ||
matplotlib | ||
numba>=0.55.0 | ||
numpy>=1.21.6 | ||
pandas>=1.3.5 | ||
pyspark>=3.3 | ||
pip | ||
prophet | ||
pyarrow | ||
scipy>=1.7.3 | ||
statsmodels>=0.13.2 | ||
tabulate | ||
plotly | ||
utilsforecast>=0.0.5 | ||
fugue[dask,ray] | ||
nbdev | ||
tqdm | ||
plotly-resampler | ||
polars | ||
supersmoother | ||
supersmoother | ||
tqdm |
Submodule docs-scripts
added at
d63d02
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.