Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "mkdocstrings-parser"
version = "0.0.1"
description = "A simple parser for mkdocstrings signature blocks"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.10"
dependencies = [
"griffe2md",
"pip-licenses>=4.5.1",
Expand All @@ -24,7 +24,7 @@ nixtlaverse = [
"coreforecast",
"utilsforecast",
"datasetsforecast",
"mlforecast[dask]",
"mlforecast",
"hierarchicalforecast",
"neuralforecast",
"statsforecast",
Expand Down
7 changes: 5 additions & 2 deletions tests/test_coreforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_regular_fn(setup_parser):
Name | Type | Description
---- | ---- | -----------
`int` | <code>[int](#int)</code> | Optimal number of differences.

"""

def test_fn_w_decorator(setup_parser):
Expand All @@ -53,7 +54,7 @@ def test_fn_w_decorator(setup_parser):

Type | Description
---- | -----------
| np.ndarray: Array with the expanding statistic
| np.ndarray: Array with the expanding statistic

**Examples:**

Expand All @@ -67,6 +68,7 @@ def test_fn_w_decorator(setup_parser):
>>> expanding_mean(x, skipna=True)
array([1., 1.5, 1.5, 2.33..., 3.0])
```

"""

def test_inherited_fn(setup_parser):
Expand All @@ -89,7 +91,7 @@ def test_inherited_fn(setup_parser):
Lag(lag)
```

Bases: <code>[\_BaseLagTransform](#coreforecast.lag_transforms._BaseLagTransform)</code>
Bases: <code>[_BaseLagTransform](#coreforecast.lag_transforms._BaseLagTransform)</code>

Simple lag operator

Expand Down Expand Up @@ -122,4 +124,5 @@ def test_inherited_fn(setup_parser):
```python
update(ga)
```

"""
2 changes: 2 additions & 0 deletions tests/test_datasetsforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def test_yearly_dataclass(setup_parser):
```python
source_url: str = 'https://zenodo.org/api/records/4656222/files/m3_yearly_dataset.zip/content'
```

"""

@pytest.mark.datasets
Expand All @@ -77,4 +78,5 @@ def test_download_file(setup_parser):
`decompress` | <code>[bool](#bool)</code> | Whether to decompress downloaded file. Default False. | <code>False</code>
`filename` | <code>[str](#str)</code> | Override filename for the downloaded file. If None, the filename is derived from the URL. | <code>None</code>
`max_retries` | <code>[int](#int)</code> | Maximum number of retry attempts on transient errors. | <code>3</code>

"""
41 changes: 21 additions & 20 deletions tests/test_hierarchicalforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_make_future_dataframe(setup_parser):
Name | Type | Description | Default
---- | ---- | ----------- | -------
`df` | <code>[Frame](#narwhals.typing.Frame)</code> | Dataframe with ids, times and values for the exogenous regressors. | *required*
`freq` | <code>[Union](#Union)\[[str](#str), [int](#int)\]</code> | Frequency of the data. Must be a valid pandas or polars offset alias, or an integer. | *required*
`freq` | <code>[Union](#Union)[[str](#str), [int](#int)]</code> | Frequency of the data. Must be a valid pandas or polars offset alias, or an integer. | *required*
`h` | <code>[int](#int)</code> | Forecast horizon. | *required*
`id_col` | <code>[str](#str)</code> | Column that identifies each serie. Default is 'unique_id'. | <code>'unique_id'</code>
`time_col` | <code>[str](#str)</code> | Column that identifies each timestep, its values can be timestamps or integers. Default is 'ds'. | <code>'ds'</code>
Expand All @@ -26,6 +26,7 @@ def test_make_future_dataframe(setup_parser):
Name | Type | Description
---- | ---- | -----------
`FrameT` | <code>[FrameT](#narwhals.typing.FrameT)</code> | DataFrame with future values.

"""

def test_evaluate(setup_parser):
Expand Down Expand Up @@ -60,6 +61,7 @@ def test_evaluate(setup_parser):
Type | Description
---- | -----------
<code>[FrameT](#narwhals.typing.FrameT)</code> | pandas, polars DataFrame: Metrics with one row per (id, metric) combination and one column per model. If `agg_fn` is not `None`, there is only one row per metric.

"""

@pytest.mark.skip(reason="waiting for new HF release")
Expand Down Expand Up @@ -172,16 +174,14 @@ def test_bottomup(setup_parser):

The most basic hierarchical reconciliation is performed using an Bottom-Up strategy. It was proposed for
the first time by Orcutt in 1968.
The corresponding hierarchical "projection" matrix is defined as:

The corresponding hierarchical \"projection\" matrix is defined as:
```math
\mathbf{P}_{\\text{BU}} = [\mathbf{0}_{\mathrm{[b],[a]}}\;|\;\mathbf{I}_{\mathrm{[b][b]}}]
```

References:

- [Orcutt, G.H., Watts, H.W., & Edwards, J.B.(1968). "Data aggregation and
information loss". The American Economic Review, 58 , 773(787)](http://www.jstor.org/stable/1815532).
information loss". The American Economic Review, 58 , 773(787)](http://www.jstor.org/stable/1815532).

#### `BottomUp.fit`

Expand All @@ -197,13 +197,13 @@ def test_bottomup(setup_parser):
---- | ---- | ----------- | -------
`S` | <code>[ndarray](#numpy.ndarray)</code> | Summing matrix of size (`base`, `bottom`). | *required*
`y_hat` | <code>[ndarray](#numpy.ndarray)</code> | Forecast values of size (`base`, `horizon`). | *required*
`y_insample` | <code>[Optional](#Optional)\[[ndarray](#numpy.ndarray)\]</code> | In-sample values of size (`base`, `horizon`). Default is None. | <code>None</code>
`y_hat_insample` | <code>[Optional](#Optional)\[[ndarray](#numpy.ndarray)\]</code> | In-sample forecast values of size (`base`, `horizon`). Default is None. | <code>None</code>
`sigmah` | <code>[Optional](#Optional)\[[ndarray](#numpy.ndarray)\]</code> | Estimated standard deviation of the conditional marginal distribution. Default is None. | <code>None</code>
`intervals_method` | <code>[Optional](#Optional)\[[str](#str)\]</code> | Sampler for prediction intervals, one of `normality`, `bootstrap`, `permbu`, `conformal`. Default is None. | <code>None</code>
`num_samples` | <code>[Optional](#Optional)\[[int](#int)\]</code> | Number of samples for probabilistic coherent distribution. Default is None. | <code>None</code>
`seed` | <code>[Optional](#Optional)\[[int](#int)\]</code> | Seed for reproducibility. Default is None. | <code>None</code>
`tags` | <code>[Optional](#Optional)\[[dict](#dict)\[[str](#str), [ndarray](#numpy.ndarray)\]\]</code> | Tags for hierarchical structure. Default is None. | <code>None</code>
`y_insample` | <code>[Optional](#Optional)[[ndarray](#numpy.ndarray)]</code> | In-sample values of size (`base`, `horizon`). Default is None. | <code>None</code>
`y_hat_insample` | <code>[Optional](#Optional)[[ndarray](#numpy.ndarray)]</code> | In-sample forecast values of size (`base`, `horizon`). Default is None. | <code>None</code>
`sigmah` | <code>[Optional](#Optional)[[ndarray](#numpy.ndarray)]</code> | Estimated standard deviation of the conditional marginal distribution. Default is None. | <code>None</code>
`intervals_method` | <code>[Optional](#Optional)[[str](#str)]</code> | Sampler for prediction intervals, one of `normality`, `bootstrap`, `permbu`, `conformal`. Default is None. | <code>None</code>
`num_samples` | <code>[Optional](#Optional)[[int](#int)]</code> | Number of samples for probabilistic coherent distribution. Default is None. | <code>None</code>
`seed` | <code>[Optional](#Optional)[[int](#int)]</code> | Seed for reproducibility. Default is None. | <code>None</code>
`tags` | <code>[Optional](#Optional)[[dict](#dict)[[str](#str), [ndarray](#numpy.ndarray)]]</code> | Tags for hierarchical structure. Default is None. | <code>None</code>

**Returns:**

Expand All @@ -225,18 +225,19 @@ def test_bottomup(setup_parser):
---- | ---- | ----------- | -------
`S` | <code>[ndarray](#numpy.ndarray)</code> | Summing matrix of size (`base`, `bottom`). | *required*
`y_hat` | <code>[ndarray](#numpy.ndarray)</code> | Forecast values of size (`base`, `horizon`). | *required*
`y_insample` | <code>[Optional](#Optional)\[[ndarray](#numpy.ndarray)\]</code> | In-sample values of size (`base`, `insample_size`). Default is None. | <code>None</code>
`y_hat_insample` | <code>[Optional](#Optional)\[[ndarray](#numpy.ndarray)\]</code> | In-sample forecast values of size (`base`, `insample_size`). Default is None. | <code>None</code>
`sigmah` | <code>[Optional](#Optional)\[[ndarray](#numpy.ndarray)\]</code> | Estimated standard deviation of the conditional marginal distribution. Default is None. | <code>None</code>
`level` | <code>[Optional](#Optional)\[[list](#list)\[[int](#int)\]\]</code> | float list 0-100, confidence levels for prediction intervals. Default is None. | <code>None</code>
`intervals_method` | <code>[Optional](#Optional)\[[str](#str)\]</code> | Sampler for prediction intervals, one of `normality`, `bootstrap`, `permbu`, `conformal`. Default is None. | <code>None</code>
`num_samples` | <code>[Optional](#Optional)\[[int](#int)\]</code> | Number of samples for probabilistic coherent distribution. Default is None. | <code>None</code>
`seed` | <code>[Optional](#Optional)\[[int](#int)\]</code> | Seed for reproducibility. Default is None. | <code>None</code>
`tags` | <code>[Optional](#Optional)\[[dict](#dict)\[[str](#str), [ndarray](#numpy.ndarray)\]\]</code> | Tags for hierarchical structure. Default is None. | <code>None</code>
`y_insample` | <code>[Optional](#Optional)[[ndarray](#numpy.ndarray)]</code> | In-sample values of size (`base`, `insample_size`). Default is None. | <code>None</code>
`y_hat_insample` | <code>[Optional](#Optional)[[ndarray](#numpy.ndarray)]</code> | In-sample forecast values of size (`base`, `insample_size`). Default is None. | <code>None</code>
`sigmah` | <code>[Optional](#Optional)[[ndarray](#numpy.ndarray)]</code> | Estimated standard deviation of the conditional marginal distribution. Default is None. | <code>None</code>
`level` | <code>[Optional](#Optional)[[list](#list)[[int](#int)]]</code> | float list 0-100, confidence levels for prediction intervals. Default is None. | <code>None</code>
`intervals_method` | <code>[Optional](#Optional)[[str](#str)]</code> | Sampler for prediction intervals, one of `normality`, `bootstrap`, `permbu`, `conformal`. Default is None. | <code>None</code>
`num_samples` | <code>[Optional](#Optional)[[int](#int)]</code> | Number of samples for probabilistic coherent distribution. Default is None. | <code>None</code>
`seed` | <code>[Optional](#Optional)[[int](#int)]</code> | Seed for reproducibility. Default is None. | <code>None</code>
`tags` | <code>[Optional](#Optional)[[dict](#dict)[[str](#str), [ndarray](#numpy.ndarray)]]</code> | Tags for hierarchical structure. Default is None. | <code>None</code>

**Returns:**

Name | Type | Description
---- | ---- | -----------
`y_tilde` | <code>[dict](#dict)</code> | Reconciliated y_hat using the Bottom Up approach.

"""
1 change: 1 addition & 0 deletions tests/test_mlforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ def test_distributed_dask_lgb(setup_parser):
```python
model_
```

"""
5 changes: 3 additions & 2 deletions tests/test_neuralforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ def test_timeseriesloader(setup_parser):

Name | Type | Description | Default
---- | ---- | ----------- | -------
`dataset` | | Dataset to load data from. | *required*
`dataset` | | Dataset to load data from. | *required*
`batch_size` | <code>[int](#int)</code> | How many samples per batch to load. Defaults to 1. | *required*
`shuffle` | <code>[bool](#bool)</code> | Set to True to have the data reshuffled at every epoch. Defaults to False. | *required*
`sampler` | <code>[Sampler](#Sampler) or [Iterable](#Iterable)</code> | Defines the strategy to draw samples from the dataset. | *required*
`drop_last` | <code>[bool](#bool)</code> | Set to True to drop the last incomplete batch. Defaults to False. | *required*
`**kwargs` | | Additional keyword arguments for DataLoader. | <code>{}</code>
`**kwargs` | | Additional keyword arguments for DataLoader. | <code>{}</code>

"""
5 changes: 3 additions & 2 deletions tests/test_statsforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_autoarima_prophet(setup_parser):

Name | Type | Description
---- | ---- | -----------
`AutoARIMAProphet` | | Adapter object with `AutoARIMA` fitted model.
`AutoARIMAProphet` | | Adapter object with `AutoARIMA` fitted model.

#### `AutoARIMAProphet.predict`

Expand All @@ -101,5 +101,6 @@ def test_autoarima_prophet(setup_parser):

Type | Description
---- | -----------
| pandas.DataFrame: DataFrame with the forecast components.
| pandas.DataFrame: DataFrame with the forecast components.

"""
1 change: 1 addition & 0 deletions tests/test_utilsforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ def test_utilsforecast_rmae(setup_parser):
Type | Description
---- | -----------
<code>[IntoDataFrameT](#narwhals.stable.v2.typing.IntoDataFrameT)</code> | pandas or polars DataFrame: dataframe with one row per id and one column per model.

"""
Loading
Loading