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="solar_demand",
    group_by="location",
    date="timestamp",
    frequency="H",
    horizon=24,        # Forecast the next 24 hours
    num_samples=100    # Generate 100 probabilistic forecast samples
)

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
targetColumn name for the variable to forecast.optional
group_byColumn name to group data by (e.g., different locations).optional
dateColumn containing the timestamp.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 list of lists, with each list containing three forecasted values: the low (10th percentile), median, and high (90th percentile). These values give you a range of possible outcomes, with the median representing the most likely forecast, and the low and high values showing the potential lower and upper bounds. This helps you understand the uncertainty of the forecast and plan for different scenarios.

Advanced options

The following keyword arguments provide additional control over the inference process:

NameDescriptionDefault
temperatureAdjusts diversity in generated samples (higher values increase variety).1.0
top_kLimits the set of options considered in each generation step.50
num_samplesSets the number of samples for probabilistic forecasts.50