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. |
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. |
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 |
n_series |
int
|
Number of individual time series. |
series_lengths |
dict
|
Mapping of series name to its |
span_index_length |
int
|
Length of the union datetime index spanning every series, from
the earliest start to the latest end at |
n_total_observations |
int
|
Pooled total number of observations across all series (the sum of
every series length). Computed automatically from
|
n_observations_display |
int
|
Task-agnostic observation count for display and summaries: the
series length for a single series, |
time_zone |
str, default None
|
Name of the time zone of the dates ( |
span_start_date |
(str, None)
|
First date of the span of |
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 |
target_stats |
dict
|
Mapping of target column (or series name) to a dict with keys
|
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 |
frequency |
str, default None
|
Inferred pandas frequency string (e.g. |
frequency_is_set |
bool, default False
|
Whether the index already has a frequency set ( |
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 |
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 |
exog_columns |
list
|
Names of exogenous predictor columns. |
categorical_exog |
list
|
Subset of |
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 |
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 |
csv_sep |
str, default ','
|
Separator of the fields of the CSV file of |
csv_decimal |
str, default '.'
|
Decimal mark of the CSV file of |
csv_thousands |
str, None, default None
|
Thousands separator of the CSV file of |
csv_encoding |
str, default 'utf-8'
|
Encoding of the CSV file of |
date_format |
str, None, default None
|
Format the generated script reads the dates of |
warnings |
list
|
Human-readable warnings generated during profiling. |
Attributes¶
categorical_exog
class-attribute
instance-attribute
¶
categorical_exog = 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: |
decimal |
str, default '.'
|
Decimal mark: |
thousands |
str, None, default None
|
Thousands separator: |
encoding |
str, default 'utf-8'
|
Encoding of the file: |
date_format |
str, None, default None
|
Format the script reads the dates with (see
|
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 |
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¶
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_abs |
list of float
|
Absolute PACF magnitude aligned element-wise with |
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 |
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,
|
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 |
window_features |
list of dict, default None
|
Window feature configurations (dicts with keys |
calendar_features |
list of str, default None
|
Recommended calendar feature names (a subset of those supported
by |
explanation |
str
|
Human-readable explanation of why this forecaster + estimator combination was chosen. |