coreforecast

0.0.17 · active · verified Fri Apr 10

coreforecast is a Python library that provides fast C++ implementations of common forecasting routines, particularly useful for transforming time series data in a grouped fashion. It's often leveraged internally by higher-level Nixtla libraries like MLForecast, StatsForecast, and NeuralForecast to achieve high performance. The current version is 0.0.17, released on February 24, 2026. Given its 'Alpha' development status, releases appear to be on an as-needed basis rather than a fixed cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the core usage of `coreforecast` by creating a `GroupedArray` and applying an `ExpandingMean` lag transformation and a `LocalStandardScaler`.

import numpy as np
from coreforecast.grouped_array import GroupedArray
from coreforecast.lag_transforms import ExpandingMean
from coreforecast.scalers import LocalStandardScaler

# The base data structure is the "grouped array"
# data: values of the series
# indptr: series boundaries such that data[indptr[i] : indptr[i + 1]] returns the i-th series.
# For example, if you have two series of sizes 3 and 7, indptr would be [0, 3, 10].
data = np.arange(10).astype(np.float32)
indptr = np.array([0, 3, 10], dtype=np.int32)
ga = GroupedArray(data, indptr)

# Apply transformations
exp_mean = ExpandingMean(lag=1).transform(ga)
scaler = LocalStandardScaler().fit(ga)
standardized = scaler.transform(ga)

print("Original data:", data)
print("GroupedArray indptr:", indptr)
print("Expanding Mean:", exp_mean)
print("Standardized data (first group):")
print(standardized.data[standardized.indptr[0]:standardized.indptr[1]])

view raw JSON →