Sulie’s SDK simplifies time series forecasting, offering both zero-shot and fine-tuned models through the Mimosa foundation model. The All-in-One plan includes 100,000 inference calls, covering both types of forecasting models.

Basic Usage

The example below demonstrates how to forecast renewable energy demand using Sulie’s forecast method.

import os
import pandas as pd
from sulie import Sulie

# Initialize Sulie client with an API key
client = Sulie(api_key=os.environ.get("SULIE_API_KEY"))

# Sample data for renewable energy demand
df = pd.DataFrame({
    "timestamp": pd.date_range(start="2023-01-01", periods=1000, freq="H"),
    "solar_demand": [...],  # Hourly solar energy demand
    "wind_demand": [...],   # Hourly wind energy demand
    "location": ["Plant A", "Plant B", ...]  # Location identifiers for different plants
})

# Forecasting solar demand per plant
forecast = client.forecast(
    dataset=df,
    target_col="solar_demand",
    id_col="location",
    timestamp_col="timestamp",
    frequency="H",
    horizon=24,        # Forecast the next 24 hours
)

Note: The maximum context length for time series data is 512 data points, and the maximum prediction horizon is 64 data points. For Enterprise users, these limits increase to 1024 and 128, respectively.

Parameters

NameDescriptionType
datasetA Sulie Dataset or pd.DataFrame with your time series data.required
horizonNumber of time steps to forecast into the future.required
target_colColumn name for the variable to forecast.optional
id_colColumn name to group data by (e.g., different locations).optional
timestamp_colColumn containing the timestamp.optional
quantilesPrediction quantiles, e.g. [0.2, 0.8]optional
aggrAggregation function to use when grouping (sum or mean).optional
frequencyTime series frequency (e.g., H for hourly, D for daily).optional
modelSpecifies the model to use (defaults to the latest Mimosa version).optional

Output

The output of the forecast function is a Forecast object.

The Forecast object includes two variables: median and quantiles, corresponding to different certainty levels in the predictions. These help you understand the range of possible outcomes, from conservative to optimistic.

You can also visualize the forecasts directly by calling the plot function:

forecast.plot()

This quickly generates a chart showing the forecast ranges, making it easy to spot trends and variability in the results. Perfect for a fast, clear analysis.

Validate forecast accuracy

The evaluate function measures the performance of a time series forecasting model by sampling random time windows from the input dataset, generating forecasts, and calculating forecast errors. Designed for robustness, it supports evaluation across single or multiple time series and computes metrics like Weighted Quantile Loss (WQL) or Weighted Absolute Percentage Error (WAPE). By running multiple iterations, it ensures reliable aggregation of results, providing insights into the model’s accuracy and adaptability to various time windows. This function is ideal for validating forecasting models in scenarios with seasonality, trends, or diverse time series data.

Parameters

NameDescriptionType
datasetA Sulie Dataset or pd.DataFrame with your time series data.required
horizonNumber of time steps to forecast into the future.required
target_colColumn name for the variable to forecast.optional
id_colColumn name to group data by (e.g., different locations).optional
metricName of the validation metric, MAE, WQL, WAPE.optional
metric_aggregationHow a final score is calculated, mean, median.optional
iterationsNumber of iterations to run.optional
modelSpecifies the model to use (defaults to the latest Mimosa version).optional