Module futureexpert.shaper

Classes

class ResultScenario (**data: Any)
Expand source code
class ResultScenario(BaseConfig):
    """Configuration of scenarios for one covariate.

    Parameters
    ----------
    ts: futureexpert.shared_models.Covariate
        Information about the covariate.
    high: typing.Sequence[futureexpert.shared_models.TimeSeriesValue]
        High scenario values.
    low: typing.Sequence[futureexpert.shared_models.TimeSeriesValue]
        Low scenario values.
    custom: typing.Optional[typing.Sequence[futureexpert.shared_models.TimeSeriesValue]]
        Custom scenario values (Optional).
    """

    ts: Covariate
    high: Sequence[TimeSeriesValue]
    low: Sequence[TimeSeriesValue]
    custom: Optional[Sequence[TimeSeriesValue]] = None

Configuration of scenarios for one covariate.

Parameters

ts : Covariate
Information about the covariate.
high : typing.Sequence[TimeSeriesValue]
High scenario values.
low : typing.Sequence[TimeSeriesValue]
Low scenario values.
custom : typing.Optional[typing.Sequence[TimeSeriesValue]]
Custom scenario values (Optional).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var custom : Sequence[TimeSeriesValue] | None
var high : Sequence[TimeSeriesValue]
var low : Sequence[TimeSeriesValue]
var model_config
var tsCovariate
class Scenario (**data: Any)
Expand source code
class Scenario(BaseConfig):
    """Configuration of scenarios for one covariate.

    Parameters
    ----------
    ts: typing.Union[futureexpert.shared_models.Covariate, futureexpert.shared_models.CovariateRef]
        The original covariate time series with lag information.
    ts_version: builtins.str
        Version of the covariate.
    high: builtins.list[futureexpert.shared_models.TimeSeriesValue]
        High scenario values.
    low: builtins.list[futureexpert.shared_models.TimeSeriesValue]
        Low scenario values.
    custom: typing.Optional[builtins.list[futureexpert.shared_models.TimeSeriesValue]]
        Custom scenario values (Optional).
    """
    ts: Union[Covariate, CovariateRef]
    ts_version: str
    high: list[TimeSeriesValue]
    low: list[TimeSeriesValue]
    custom: Optional[list[TimeSeriesValue]] = None

    def add_custom_values(self, values: list[float]) -> None:
        """Add custom scenario values to the Scenario.

    Parameters
    ----------
    values: builtins.list[builtins.float]

    return: builtins.NoneType

    """
        if len(values) != len(self.high):
            raise ValueError('All Scenarios need the same length')
        self.custom = [TimeSeriesValue(time_stamp_utc=x.time_stamp_utc, value=values[idx])
                       for idx, x in enumerate(self.high)]

Configuration of scenarios for one covariate.

Parameters

ts : typing.Union[Covariate, CovariateRef]
The original covariate time series with lag information.
ts_version : builtins.str
Version of the covariate.
high : builtins.list[TimeSeriesValue]
High scenario values.
low : builtins.list[TimeSeriesValue]
Low scenario values.
custom : typing.Optional[builtins.list[TimeSeriesValue]]
Custom scenario values (Optional).

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var custom : list[TimeSeriesValue] | None
var high : list[TimeSeriesValue]
var low : list[TimeSeriesValue]
var model_config
var tsCovariate | CovariateRef
var ts_version : str

Methods

def add_custom_values(self, values: list[float]) ‑> None
Expand source code
def add_custom_values(self, values: list[float]) -> None:
    """Add custom scenario values to the Scenario.

Parameters
----------
values: builtins.list[builtins.float]

return: builtins.NoneType

"""
    if len(values) != len(self.high):
        raise ValueError('All Scenarios need the same length')
    self.custom = [TimeSeriesValue(time_stamp_utc=x.time_stamp_utc, value=values[idx])
                   for idx, x in enumerate(self.high)]

Add custom scenario values to the Scenario.

Parameters

values : builtins.list[builtins.float]
 
return : builtins.NoneType
 
class ScenarioValuesConfig (**data: Any)
Expand source code
class ScenarioValuesConfig(BaseConfig):
    """Configuration for scenario values creation.

    Parameters
    ----------
    actuals_version: builtins.str
        Version from the time series that should get forecasted.
    actuals_name: builtins.str
        Name of the actuals time series.
    covariate_versions: builtins.list[builtins.str]
        All the covariate versions from the covariates listed in `covariates`.
    covariates: builtins.list[futureexpert.shared_models.CovariateRef]
        List of covariates to create scenarios for.
    fc_horizon: builtins.int
        The number of forecast periods.
    """
    actuals_version: str
    actuals_name: str
    covariate_versions: list[str]
    covariates: list[CovariateRef]
    fc_horizon: int

Configuration for scenario values creation.

Parameters

actuals_version : builtins.str
Version from the time series that should get forecasted.
actuals_name : builtins.str
Name of the actuals time series.
covariate_versions : builtins.list[builtins.str]
All the covariate versions from the covariates listed in covariates.
covariates : builtins.list[CovariateRef]
List of covariates to create scenarios for.
fc_horizon : builtins.int
The number of forecast periods.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var actuals_name : str
var actuals_version : str
var covariate_versions : list[str]
var covariates : list[CovariateRef]
var fc_horizon : int
var model_config
class ShaperConfig (**data: Any)
Expand source code
class ShaperConfig(BaseConfig):
    """Configuration of a shaper run.

    Parameters
    ----------
    report_note: builtins.str
        Title of the report.
    actuals_version: builtins.str
        Version of the actuals.
    actuals_name: builtins.str
        Name of the time series.
    scenarios: builtins.list[futureexpert.shaper.Scenario]
        Information about the covariates and their scenario values.
    db_name: typing.Optional[builtins.str]
        Only accessible for internal use. Name of the database to use for storing the results.
    """
    report_note: str
    actuals_version: str
    actuals_name: str
    scenarios: list[Scenario]
    db_name: Optional[str] = None

Configuration of a shaper run.

Parameters

report_note : builtins.str
Title of the report.
actuals_version : builtins.str
Version of the actuals.
actuals_name : builtins.str
Name of the time series.
scenarios : builtins.list[Scenario]
Information about the covariates and their scenario values.
db_name : typing.Optional[builtins.str]
Only accessible for internal use. Name of the database to use for storing the results.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var actuals_name : str
var actuals_version : str
var db_name : str | None
var model_config
var report_note : str
var scenarios : list[Scenario]
class ShaperInput (**data: Any)
Expand source code
class ShaperInput(BaseModel):
    """Input of the shaper service.

    Parameters
    ----------
    actuals: futureexpert.shared_models.TimeSeries
        Time series for which the forecasts where performed.
    scenarios: builtins.list[futureexpert.shaper.ResultScenario]
        The Scenario Information.
    """
    actuals: TimeSeries
    scenarios: list[ResultScenario]

Input of the shaper service.

Parameters

actuals : TimeSeries
Time series for which the forecasts where performed.
scenarios : builtins.list[ResultScenario]
The Scenario Information.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

  • pydantic.main.BaseModel

Class variables

var actualsTimeSeries
var model_config
var scenarios : list[ResultScenario]
class ShaperResult (**data: Any)
Expand source code
class ShaperResult(BaseModel):
    """Result of the shaper service.

   Parameters
    ----------
    input: futureexpert.shaper.ShaperInput
        Input Information.
    forecast_low: typing.Sequence[futureexpert.forecast.ForecastValue]
        Forecast values of the low scenario.
    forecast_high: typing.Sequence[futureexpert.forecast.ForecastValue]
        Forecast values of the high scenario.
    forecast_custom: typing.Sequence[futureexpert.forecast.ForecastValue]
        Forecast values of the custom scenario.
    """
    input: ShaperInput
    forecast_low: Sequence[ForecastValue]
    forecast_high: Sequence[ForecastValue]
    forecast_custom: Sequence[ForecastValue]

Result of the shaper service.

Parameters


input: futureexpert.shaper.ShaperInput Input Information. forecast_low: typing.Sequence[futureexpert.forecast.ForecastValue] Forecast values of the low scenario. forecast_high: typing.Sequence[futureexpert.forecast.ForecastValue] Forecast values of the high scenario. forecast_custom: typing.Sequence[futureexpert.forecast.ForecastValue] Forecast values of the custom scenario.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

  • pydantic.main.BaseModel

Class variables

var forecast_custom : Sequence[ForecastValue]
var forecast_high : Sequence[ForecastValue]
var forecast_low : Sequence[ForecastValue]
var inputShaperInput
var model_config