Fast implementations of common forecasting routines
Project description
Motivation
At Nixtla we have implemented several libraries to deal with time series data. We often have to apply some transformation over all of the series, which can prove time consuming even for simple operations like performing some kind of scaling.
We've used numba to speed up our expensive computations, however that comes with other issues such as cold starts and more dependencies (LLVM). That's why we developed this library, which implements several operators in C++ to transform time series data (or other kind of data that can be thought of as independent groups), with the possibility to use multithreading to get the best performance possible.
You probably won't need to use this library directly but rather use one of our higher level libraries like mlforecast, which will use this library under the hood. If you're interested on using this library directly (only depends on numpy) you should continue reading.
Installation
PyPI
pip install coreforecast
conda-forge
conda install -c conda-forge coreforecast
Minimal example
The base data structure is the "grouped array" which holds two numpy 1d arrays:
- data: values of the series.
- indptr: series boundaries such that
data[indptr[i] : indptr[i + 1]]
returns thei-th
series. For example, if you have two series of sizes 5 and 10 the indptr would be [0, 5, 15].
import numpy as np
from coreforecast.grouped_array import GroupedArray
data = np.arange(10)
indptr = np.array([0, 3, 10])
ga = GroupedArray(data, indptr)
Once you have this structure you can run any of the provided transformations, for example:
from coreforecast.lag_transforms import ExpandingMean
from coreforecast.scalers import LocalStandardScaler
exp_mean = ExpandingMean(lag=1).transform(ga)
scaler = LocalStandardScaler().fit(ga)
standardized = scaler.transform(ga)
Single-array functions
We've also implemented some functions that work on single arrays, you can refer to the following pages:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file coreforecast-0.0.12.tar.gz
.
File metadata
- Download URL: coreforecast-0.0.12.tar.gz
- Upload date:
- Size: 43.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52af687933d0d6a61a8fabdc656b3fc2b62ac55cd44739e5ebb456afdd759bd3 |
|
MD5 | 425ef74397726f07b6ff5334526a6f80 |
|
BLAKE2b-256 | c503004ad209ecbc459e8030816c3909ab4998ffdf97d2b0195e36c53a1db69f |
File details
Details for the file coreforecast-0.0.12-py3-none-win_amd64.whl
.
File metadata
- Download URL: coreforecast-0.0.12-py3-none-win_amd64.whl
- Upload date:
- Size: 101.8 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e50d085cd40d4aeec957edbc50b230ae6df5985b946c9f2ad02f6cc2cb79a9c |
|
MD5 | bef480a34a409baabf1c48d00fa77ef0 |
|
BLAKE2b-256 | 01bb8c44f08b356dc33abe5c24f9ca6a1c3b9f2423dd1dc050bc6a6a63861585 |
File details
Details for the file coreforecast-0.0.12-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: coreforecast-0.0.12-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 196.7 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | befcf2991a0f605c110462ea38ec8d115799f44d26e733cd2baa590f0aaea889 |
|
MD5 | 1dbafcc538bf588e67e2e3de1067870f |
|
BLAKE2b-256 | 761f396b32dfe83034db97c8ac63e669ddc5a18e4f960b2a8b399ad8dcd13168 |
File details
Details for the file coreforecast-0.0.12-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: coreforecast-0.0.12-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 181.7 kB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25eb7670c4b29324c8ddc52454038ade843ced8882009b11085ed5dca7bbf0f9 |
|
MD5 | 83d101e433585b6e558d63c4c527d0be |
|
BLAKE2b-256 | abbcdcee69a93ca250cec4f700c7a398b1e396c4f7b78aad01591d8b1b5fd3b1 |
File details
Details for the file coreforecast-0.0.12-py3-none-macosx_11_0_arm64.whl
.
File metadata
- Download URL: coreforecast-0.0.12-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 110.3 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 761a73c0c15df7008852f55cae6f0001e069447ee28b7d1f1fe14825497a91d1 |
|
MD5 | af46883e8185f1bbb98c7292cb14f6dc |
|
BLAKE2b-256 | 95c13b2fbcb6e92994f44279e74cad4a093679b461eed91791fd626da8c45f72 |
File details
Details for the file coreforecast-0.0.12-py3-none-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: coreforecast-0.0.12-py3-none-macosx_10_9_x86_64.whl
- Upload date:
- Size: 125.9 kB
- Tags: Python 3, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51a13bb737e06276b79a6e70016b9361b69859cc7020ea779116ba6bcd72c2d5 |
|
MD5 | 1c6dc4190f1024a722d71678e827bc35 |
|
BLAKE2b-256 | ffdf41b1e28a7dc978a0ead0c0b803bf2b2a95de8658eb1c0e3a4e5fbb222110 |