Skip to content

Commit

Permalink
more doc tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jwdink committed Jan 6, 2025
1 parent 3cea908 commit 4b4cbb0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 22 deletions.
10 changes: 6 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
torchcast
==========

``torchcast`` is a Python package for forecasting with state-space models built on top of `PyTorch <http://pytorch.org>`_. Its focus is training and forecasting with *batches* of time-series, rather than training separate models for one time-series at a time. In addition, it provides robust support for *multivariate* time-series, where multiple correlated measures are being forecasted.
``torchcast`` is a Python package for forecasting built on top of `PyTorch <http://pytorch.org>`_. Its benefits include:

Currently the focus of ``torchcast`` is building models that are hybrids: they are classic state-space models with the twist that every part of these models is differentiable and can take advantage of PyTorch's flexibility. For `example <https://torchcast.readthedocs.io/en/latest/examples/electricity.html#Training-our-Hybrid-Forecasting-Model>`_, we can use any PyTorch ``Module`` to predict the variance of forecasts or even to generate the underlying states themselves.
1. An API designed around training and forecasting with *batches* of time-series, rather than training separate models for one time-series at a time.
2. Robust support for *multivariate* time-series, where multiple correlated measures are being forecasted.
3. Forecasting models that are hybrids: they are classic state-space models with the twist that every part is differentiable and can take advantage of PyTorch's flexibility. For `example <https://docs.strong.io/torchcast/examples/electricity.html#Training-our-Hybrid-Forecasting-Model>`_, we can use arbitrary PyTorch :class:`torch.nn.Modules` to learn seasonal variations across multiple groups, embedding complex seasonality into lower-dimensional space.

This repository is the work of `Strong Analytics <https://www.strong.io/>`_.
This repository is the work of `Strong <https://www.strong.io/>`_.

.. image:: docs/examples_air_quality_6_2.png

Expand All @@ -20,4 +22,4 @@ Getting Started
``torchcast`` requires Python >= 3.8 and PyTorch >= 1.8.

See the `Quick Start <https://torchcast.readthedocs.io/en/latest/quick_start.html>`_ for a simple example that will get you up to speed, or delve into the `examples <https://torchcast.readthedocs.io/en/latest/examples/examples.html>`_ or the `API <https://torchcast.readthedocs.io/en/latest/api/api.html>`_.
See the `Quick Start <https://docs.strong.io/torchcast/quick_start.html>`_ for a simple example that will get you up to speed, or delve into the `examples <https://docs.strong.io/torchcast/examples/examples.html>`_ or the `API <https://docs.strong.io/torchcast/api/api.html>`_.
2 changes: 1 addition & 1 deletion docs/api/processes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Processes

.. automodule:: torchcast.process
:members: LocalLevel, LocalTrend, Season, LinearModel
:exclude-members: forward
:exclude-members: forward, solve_and_predict
2 changes: 1 addition & 1 deletion docs/quick_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
# The `Predictions` class comes with a `plot` classmethod for getting simple plots of forecasted vs. actual:

# %%
print(pred.plot(df_pred.query("group=='Changping'"), split_dt=SPLIT_DT, time_colname='time', group_colname='group'))
pred.plot(df_pred.query("group=='Changping'"), split_dt=SPLIT_DT, time_colname='time', group_colname='group')

# %% [markdown]
# Finally you can produce dataframes that decompose the predictions into the underlying `processes` that produced them:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dynamic = ["version"]
[project.urls]
Repository = "https://github.com/strongio/torchcast"
"Bug Tracker" = "https://github.com/strongio/torchcast/issues"
Documentation = "https://torchcast.readthedocs.io/en/latest/"
Documentation = "https://docs.strong.io/torchcast/"

[project.optional-dependencies]
dev = [
Expand Down
7 changes: 0 additions & 7 deletions readthedocs.yml

This file was deleted.

4 changes: 3 additions & 1 deletion torchcast/state_space/predictions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
from functools import cached_property

from torchcast.internals.utils import get_nan_groups, is_near_zero, transpose_last_dims
from torchcast.utils import conf2bounds, TimeSeriesDataset, class_or_instancemethod
from torchcast.utils import TimeSeriesDataset
from torchcast.utils.stats import conf2bounds
from torchcast.utils.misc import class_or_instancemethod

if TYPE_CHECKING:
from torchcast.state_space import StateSpaceModel
Expand Down
13 changes: 6 additions & 7 deletions torchcast/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""
The data-utils in this module are useful for converting time-series data from a Pandas DataFrame into a PyTorch
:class:`torch.utils.data.Dataset` and/or :class:`torch.utils.data.DataLoader`. The most common pattern is using the
``from_dataframe()`` classmethod.
This module includes:
Additionally, utility functions are provided for handling missing data and adding calendar-features (i.e.
weekly/daily/yearly season dummy-features that can be passed to any neural-network).
- Data-utils for converting time-series data from a Pandas DataFrame into a PyTorch :class:`torch.utils.data.Dataset`
and/or :class:`torch.utils.data.DataLoader`. The most common pattern is using the ``from_dataframe()`` classmethod.
- A function for handling implicit missing data
- A function for adding calendar-features: i.e. weekly/daily/yearly season dummy-features.
"""

from .features import add_season_features
from .data import TimeSeriesDataset, TimeSeriesDataLoader, complete_times
from .stats import conf2bounds
from .misc import class_or_instancemethod
from .baseline import make_baseline
from .training import SimpleTrainer, StateSpaceTrainer, SeasonalEmbeddingsTrainer

0 comments on commit 4b4cbb0

Please sign in to comment.