Module futureexpert.shared_models
Shared models used across multiple modules.
Classes
-
Expand source code
class BaseConfig(BaseModel): """Base configuration that is used for most models.""" model_config = ConfigDict(allow_inf_nan=False, extra='forbid', arbitrary_types_allowed=True)
Base configuration that is used for most models.
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 allowself
as a field name.Ancestors
- pydantic.main.BaseModel
Subclasses
Class variables
-
Expand source code
class Covariate(BaseModel): """Covariate. Parameters ---------- ts: futureexpert.shared_models.TimeSeries Time series object of the covariate. Not lagged. lag: builtins.int Lag by which the covariate was used. """ ts: TimeSeries lag: int
Covariate.
Parameters
ts
:TimeSeries
- Time series object of the covariate. Not lagged.
lag
:builtins.int
- Lag by which the covariate was used.
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 allowself
as a field name.Ancestors
- pydantic.main.BaseModel
Class variables
-
Expand source code
class CovariateRef(BaseModel): """Covariate reference. Parameters ---------- name: builtins.str Name of the Covariate lag: builtins.int Lag by which the covariate was used. """ name: str lag: int
Covariate reference.
Parameters
name
:builtins.str
- Name of the Covariate
lag
:builtins.int
- Lag by which the covariate was used.
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 allowself
as a field name.Ancestors
- pydantic.main.BaseModel
Class variables
-
Expand source code
class PositiveInt(int): def __new__(cls, value: int) -> PositiveInt: if value < 1: raise ValueError('The value must be a positive integer.') return super().__new__(cls, value)
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating-point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
>>> int('0b100', base=0) 4
Ancestors
- builtins.int
-
Expand source code
class TimeSeries(BaseModel): """Time series data. Parameters ---------- name: builtins.str Name of the time series. group: builtins.str Group of the time series. granularity: builtins.str Granularity of the time series. values: typing.Sequence The actual values of the time series. unit: typing.Optional The unit of the time . unit_factors: typing.Optional Factors to convert the time series in another unit. grouping: typing.Optional Hierarchy levels ot the time series. """ name: Annotated[str, Field(min_length=1)] group: str granularity: Annotated[str, Field(min_length=1)] values: Annotated[Sequence[TimeSeriesValue], Field(min_length=1)] unit: Optional[str] = None unit_factors: Optional[dict[str, float]] = None grouping: Optional[dict[str, Union[str, int]]] = None
Time series data.
Parameters
name
:builtins.str
- Name of the time series.
group
:builtins.str
- Group of the time series.
granularity
:builtins.str
- Granularity of the time series.
values
:typing.Sequence
- The actual values of the time series.
unit
:typing.Optional
- The unit of the time .
unit_factors
:typing.Optional
- Factors to convert the time series in another unit.
grouping
:typing.Optional
- Hierarchy levels ot the time series.
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 allowself
as a field name.Ancestors
- pydantic.main.BaseModel
Class variables
-
Expand source code
class TimeSeriesValue(BaseModel): """Value of a time series. Parameters ---------- time_stamp_utc: datetime.datetime The time stamp of the value. value: builtins.float The value. """ time_stamp_utc: datetime value: Annotated[float, Field(allow_inf_nan=False)]
Value of a time series.
Parameters
time_stamp_utc
:datetime.datetime
- The time stamp of the value.
value
:builtins.float
- The value.
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 allowself
as a field name.Ancestors
- pydantic.main.BaseModel
Class variables