Skip to content

Profiles

What profile() finds in the data. ForecastingProfile is the object you pass to plan(), create_cv() and ask(): it holds summary statistics of the dataset (a DataProfile), the significant lags of each series and the recommended forecaster and estimator, never the observations themselves.

skforecast_ai.schemas.profiles

Classes:

Name Description
SeriesLengthInfo

Per-series index range and observation count.

DataProfile

Profile of the input time series dataset.

FutureExogFile

CSV file the generated script reads the future exogenous variables from,

SeriesPacf

PACF-significant lags for a single series.

ForecastingProfile

High-level profile of the forecasting problem.

Classes

SeriesLengthInfo

Bases: BaseModel

Per-series index range and observation count.

Attributes:

Name Type Description
start str, default None

First timestamp of the series as a string (e.g. '2020-01-01'): its first row in long format, its first value in wide format. None when the index is not datetime.

end str, default None

Last timestamp of the series as a string: its last row in long format, its last value in wide format. None when the index is not datetime.

length int

Number of observations in the series: its rows in long format, the rows from its first to its last value in wide format.

Attributes
start class-attribute instance-attribute
start = None
end class-attribute instance-attribute
end = None
length instance-attribute
length

DataProfile

Bases: PickleDefaultsMixin, BaseModel

Profile of the input time series dataset.

Attributes:

Name Type Description
data_format str, default 'single'

Layout of the dataset. One of 'single', 'wide', 'long'.

n_series int

Number of individual time series.

series_lengths dict

Mapping of series name to its SeriesLengthInfo (start, end, and length). Always populated, including single series (keyed by the target name). A series of long format spans its own rows, and one of wide format the rows from its first to its last value (the missing values at both ends are dates it has not started or has ended on). The task-aware effective number of observations is derived from this mapping (span for multi_series, common length for multivariate, single length otherwise).

span_index_length int

Length of the union datetime index spanning every series, from the earliest start to the latest end at frequency. Falls back to the longest individual series when datetime bounds or frequency are unavailable. Computed automatically from series_lengths, except for wide format when given: there it is the dates of the frame, from its first row to its last one, which every series shares.

n_total_observations int

Pooled total number of observations across all series (the sum of every series length). Computed automatically from series_lengths.

n_observations_display int

Task-agnostic observation count for display and summaries: the series length for a single series, span_index_length otherwise.

time_zone str, default None

Name of the time zone of the dates ('Europe/Madrid', 'UTC'), or None when they have none or it cannot be rebuilt from its name. start_date is then written as local time, without its UTC offset, and the positions and the dates of a cross-validation strategy are counted on the local times of the data, which skip or repeat an hour at a daylight saving change.

span_start_date (str, None)

First date of the span of span_index_length: start_date, or in long format the earliest first date of the series.

target (str, list)

Name(s) of the target column(s). A single string for single series and long format. A list of strings for wide format where each element is a series column.

target_dtype str, default 'numeric'

Data type category of the target column. One of 'numeric', 'categorical', 'other'.

target_stats dict

Mapping of target column (or series name) to a dict with keys 'min', 'max', 'mean', 'std' computed on non-NaN values. Empty dict if no valid observations exist.

missing_target dict

Mapping of target column (or series name) to count of NaN values. Only entries with at least one missing value are included.

date_column str, default None

Name of the column containing timestamps.

series_id_column str, default None

Name of the column identifying individual series.

index_type str

Type of the DataFrame index. One of 'datetime', 'range', 'other'.

frequency str, default None

Inferred pandas frequency string (e.g. 'h', 'D', 'ME'). In long format, the frequency shared by every series.

frequency_is_set bool, default False

Whether the index already has a frequency set (index.freq). False when the rows were not in date order.

index_is_monotonic bool, default True

Whether the input was in ascending date order (within each series, for long format). Rows out of order are sorted before profiling, with a note in warnings, so the other fields describe the sorted data.

has_gaps bool, default False

Whether the datetime index has missing timestamps within its range (in long format, whether any series has them within its own range).

closed_weekdays list, default []

Days of the week (0 for Monday) that every missing timestamp falls on, when the data (each series, in long format) never has a date on them, as a shop closed on Sundays: the days the note on missing timestamps names. Empty when no timestamp is missing, when one of them falls on a day of the week that has dates, or when the frequency is coarser than a day.

has_duplicate_timestamps bool, default False

Whether some timestamps appear in several identical rows, which the generated code drops. Timestamps repeated with different values raise a ValueError during profiling.

exog_columns list

Names of exogenous predictor columns.

categorical_exog list

Subset of exog_columns that are categorical.

missing_exog dict

Mapping of exogenous column name to count of missing values. Only columns with at least one missing value are included.

unused_columns list, default []

Columns of the data that are neither the target, the date, the series id nor an exogenous variable: left out with exog_columns of profile(), or columns of data passed with a saved profile that does not name them. The generated script does not read them.

data_path str, default 'data.csv'

Path to the source CSV file. Derived automatically during profiling: if the input is a file path, this stores it; if the input is a DataFrame, defaults to 'data.csv'.

csv_sep str, default ','

Separator of the fields of the CSV file of data_path: ',', ';' or a tabulator. Detected when the file is profiled, or given with sep; the generated script reads the file with it. ',' for data passed in memory.

csv_decimal str, default '.'

Decimal mark of the CSV file of data_path: '.' or ',', the latter only when csv_sep is not ','. Detected when the file is profiled, or given with decimal; the generated script reads the file with it.

csv_thousands str, None, default None

Thousands separator of the CSV file of data_path: '.', only with ',' as csv_decimal, or None when its numbers have none. Detected when the file is profiled, or given with thousands; the generated script reads the file with it.

csv_encoding str, default 'utf-8'

Encoding of the CSV file of data_path: 'utf-8', with or without a byte order mark, or 'cp1252' (Windows-1252, the "CSV" that Excel saves on Windows) for a file that is not UTF-8, with a note in warnings, as that encoding cannot be checked. Detected every time the file is read; the generated script reads the file with encoding='cp1252'. 'utf-8' for data passed in memory.

date_format str, None, default None

Format the generated script reads the dates of date_column with (pandas.to_datetime(..., format=date_format)), or None when it reads them without one, as pandas guesses it from the first date: '%d/%m/%Y' and the like for dates written day first (which pandas reads month first unless told, whatever the first date), the order given with dayfirst for dates that read both day first and month first, and '%Y%m%d' for dates written as whole numbers (20200131).

warnings list

Human-readable warnings generated during profiling.

Attributes
data_format class-attribute instance-attribute
data_format = 'single'
n_series instance-attribute
n_series
series_lengths instance-attribute
series_lengths
span_index_length class-attribute instance-attribute
span_index_length = 0
n_total_observations class-attribute instance-attribute
n_total_observations = 0
target instance-attribute
target
target_dtype class-attribute instance-attribute
target_dtype = 'numeric'
target_stats class-attribute instance-attribute
target_stats = Field(default_factory=dict)
missing_target class-attribute instance-attribute
missing_target = Field(default_factory=dict)
date_column class-attribute instance-attribute
date_column = None
series_id_column class-attribute instance-attribute
series_id_column = None
index_type instance-attribute
index_type
frequency class-attribute instance-attribute
frequency = None
frequency_is_set class-attribute instance-attribute
frequency_is_set = False
index_is_monotonic class-attribute instance-attribute
index_is_monotonic = True
has_gaps class-attribute instance-attribute
has_gaps = False
closed_weekdays class-attribute instance-attribute
closed_weekdays = Field(default_factory=list)
has_duplicate_timestamps class-attribute instance-attribute
has_duplicate_timestamps = False
exog_columns class-attribute instance-attribute
exog_columns = Field(default_factory=list)
categorical_exog class-attribute instance-attribute
categorical_exog = Field(default_factory=list)
missing_exog class-attribute instance-attribute
missing_exog = Field(default_factory=dict)
unused_columns class-attribute instance-attribute
unused_columns = Field(default_factory=list)
data_path class-attribute instance-attribute
data_path = 'data.csv'
csv_sep class-attribute instance-attribute
csv_sep = ','
csv_decimal class-attribute instance-attribute
csv_decimal = '.'
csv_thousands class-attribute instance-attribute
csv_thousands = None
csv_encoding class-attribute instance-attribute
csv_encoding = 'utf-8'
date_format class-attribute instance-attribute
date_format = None
start_date class-attribute instance-attribute
start_date = None
time_zone class-attribute instance-attribute
time_zone = None
warnings class-attribute instance-attribute
warnings = Field(default_factory=list)
span_start_date property
span_start_date

First date of the span of the data, where span_index_length starts.

It is start_date, except in long format, where start_date is the latest first date of the series and the span starts at the earliest one (the union index of the series). The earliest is taken only when span_index_length observations at frequency run from it to the last date of the series; otherwise (a span counted as the longest series, dates that mix time zones) it is start_date, as before.

Returns:

Name Type Description
span_start_date (str, None)

First date of the span, or None without dates.

n_observations_display property
n_observations_display

Task-agnostic observation count for display and summaries.

Returns the series length for single-series data and the union span (span_index_length) for multi-series data.

Returns:

Name Type Description
n_observations int

Representative observation count for display.

FutureExogFile

Bases: BaseModel

CSV file the generated script reads the future exogenous variables from, and how it is written.

Future values read from a file (exog_path of the MCP server, --exog of the CLI) are read by the script from that same path, with the dialect detected when they were read, as the data are read with the one of the profile (csv_sep, csv_decimal, csv_thousands, csv_encoding). Future values passed in memory are read from exog_future.csv, the frame saved with to_csv(): ',', '.', no thousands separator and UTF-8. The script names each argument only when it is not the default of pandas.

Attributes:

Name Type Description
path str, default 'exog_future.csv'

Path of the CSV file the script reads.

sep str, default ','

Separator of the fields: ',', ';' or a tabulator.

decimal str, default '.'

Decimal mark: '.' or ',', the latter only when sep is not ','.

thousands str, None, default None

Thousands separator: '.', only with ',' as decimal, or None when the numbers have none.

encoding str, default 'utf-8'

Encoding of the file: 'utf-8' or 'cp1252'.

date_format str, None, default None

Format the script reads the dates with (see DataProfile.date_format), the one of the future values and not the one of the data, or None when it reads them without one.

date_column str, None, default None

Column of the file that holds the dates, the date column of the data when it has one, or None for exog_future.csv and for a file of data without dates. For data dated by their index, the script reads the dates from it.

blank_rows bool, default False

Whether the file has rows made only of separators (a spreadsheet saved as CSV), which hold no date and no value: the script drops them, as they were dropped when the file was read.

by_position bool, default False

Whether the rows of the file are the steps of the horizon in order, without a column of positions: future values of data without dates whose file has no index. The script numbers them from the position that follows the last row of the data. False reads the first column as the index (the dates, or the positions of data without dates).

Attributes
model_config class-attribute instance-attribute
model_config = {'frozen': True}
path class-attribute instance-attribute
path = 'exog_future.csv'
sep class-attribute instance-attribute
sep = ','
decimal class-attribute instance-attribute
decimal = '.'
thousands class-attribute instance-attribute
thousands = None
encoding class-attribute instance-attribute
encoding = 'utf-8'
date_format class-attribute instance-attribute
date_format = None
date_column class-attribute instance-attribute
date_column = None
blank_rows class-attribute instance-attribute
blank_rows = False
by_position class-attribute instance-attribute
by_position = False

SeriesPacf

Bases: BaseModel

PACF-significant lags for a single series.

Attributes:

Name Type Description
series_id str

Name of the series (target column for single/wide, series id for long format).

n_observations int

Number of non-NaN observations in the series (all NaNs, edge and interior, are excluded by the count). Used as the sample size for the PACF significance test. Not the raw column length.

lags list of int

Significant lags retained by Benjamini-Hochberg FDR correction and the minimum effect-size floor, ordered by descending |PACF| (importance order, not ascending index).

pacf_abs list of float

Absolute PACF magnitude aligned element-wise with lags (same order).

Attributes
series_id instance-attribute
series_id
n_observations instance-attribute
n_observations
lags class-attribute instance-attribute
lags = Field(default_factory=list)
pacf_abs class-attribute instance-attribute
pacf_abs = Field(default_factory=list)

ForecastingProfile

Bases: PickleDefaultsMixin, DisplayMixin, ExplainableResult, BaseModel

High-level profile of the forecasting problem.

Combines the dataset profile with the coarse modeling decisions: which forecaster family to use, which estimator to pair with it, and the alternative candidates the user could switch to. Detailed configuration (lags, metric, intervals, NaN handling, preprocessing) is left to ForecastPlan.

Attributes:

Name Type Description
data_profile DataProfile

Profile of the input dataset (independent of the forecasting decisions).

task_type str

Forecasting task category implied by the selected forecaster. One of 'single_series', 'multi_series', 'multivariate', 'statistical', 'foundation'.

forecaster str

Selected skforecast forecaster class name.

forecaster_candidates list

Ordered list of compatible forecaster class names. The first item is the preferred default.

estimator str, default None

Selected estimator: a scikit-learn compatible estimator name, 'Arima' for statistical tasks, or the Hugging Face model ID of the foundation model for foundation tasks. None for the baseline, which has no estimator.

estimator_candidates list

Ordered list of compatible estimator names. Empty for the baseline.

series_pacf list of SeriesPacf

Per-series PACF-significant lags (the forecaster-invariant lag primitive). Empty for statistical and foundation tasks. The final lag set is derived in plan() by aggregating these primitives for the chosen forecaster.

window_features list of dict, default None

Window feature configurations (dicts with keys 'stats' and 'window_size'). Computed eagerly at profile time as they are forecaster-invariant. None when the series is too short or the task is statistical/foundation.

calendar_features list of str, default None

Recommended calendar feature names (a subset of those supported by skforecast.preprocessing.CalendarFeatures). Computed eagerly at profile time as they depend only on the index frequency and series length. None when the frequency is unknown, the series is too short, the frequency has no sub-period seasonality, or the task is statistical/foundation. The encoding is chosen later in plan() based on the resolved estimator.

explanation str

Human-readable explanation of why this forecaster + estimator combination was chosen.

Attributes
data_profile instance-attribute
data_profile
task_type instance-attribute
task_type
forecaster instance-attribute
forecaster
forecaster_candidates class-attribute instance-attribute
forecaster_candidates = Field(default_factory=list)
estimator class-attribute instance-attribute
estimator = None
estimator_candidates class-attribute instance-attribute
estimator_candidates = Field(default_factory=list)
series_pacf class-attribute instance-attribute
series_pacf = Field(default_factory=list)
window_features class-attribute instance-attribute
window_features = None
calendar_features class-attribute instance-attribute
calendar_features = None
explanation instance-attribute
explanation

Functions: