module mlforecast.lag_transforms


class Lag

method __init__

__init__(lag: int)

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class RollingMean

method __init__

__init__(window_size: int, min_samples: Optional[int] = None)
Args:
  • window_size (int): Number of samples in the window.
  • min_samples (int, optional): Minimum samples required to output the statistic. If None, will be set to window_size. Defaults to None.

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class RollingStd

method __init__

__init__(window_size: int, min_samples: Optional[int] = None)
Args:
  • window_size (int): Number of samples in the window.
  • min_samples (int, optional): Minimum samples required to output the statistic. If None, will be set to window_size. Defaults to None.

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class RollingMin

method __init__

__init__(window_size: int, min_samples: Optional[int] = None)
Args:
  • window_size (int): Number of samples in the window.
  • min_samples (int, optional): Minimum samples required to output the statistic. If None, will be set to window_size. Defaults to None.

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class RollingMax

method __init__

__init__(window_size: int, min_samples: Optional[int] = None)
Args:
  • window_size (int): Number of samples in the window.
  • min_samples (int, optional): Minimum samples required to output the statistic. If None, will be set to window_size. Defaults to None.

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class RollingQuantile

method __init__

__init__(p: float, window_size: int, min_samples: Optional[int] = None)

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class SeasonalRollingMean

method __init__

__init__(
    season_length: int,
    window_size: int,
    min_samples: Optional[int] = None
)
Args:
  • season_length (int): Periodicity of the seasonal period.
  • window_size (int): Number of samples in the window.
  • min_samples (int, optional): Minimum samples required to output the statistic. If None, will be set to window_size. Defaults to None.

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class SeasonalRollingStd

method __init__

__init__(
    season_length: int,
    window_size: int,
    min_samples: Optional[int] = None
)
Args:
  • season_length (int): Periodicity of the seasonal period.
  • window_size (int): Number of samples in the window.
  • min_samples (int, optional): Minimum samples required to output the statistic. If None, will be set to window_size. Defaults to None.

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class SeasonalRollingMin

method __init__

__init__(
    season_length: int,
    window_size: int,
    min_samples: Optional[int] = None
)
Args:
  • season_length (int): Periodicity of the seasonal period.
  • window_size (int): Number of samples in the window.
  • min_samples (int, optional): Minimum samples required to output the statistic. If None, will be set to window_size. Defaults to None.

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class SeasonalRollingMax

method __init__

__init__(
    season_length: int,
    window_size: int,
    min_samples: Optional[int] = None
)
Args:
  • season_length (int): Periodicity of the seasonal period.
  • window_size (int): Number of samples in the window.
  • min_samples (int, optional): Minimum samples required to output the statistic. If None, will be set to window_size. Defaults to None.

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class SeasonalRollingQuantile

method __init__

__init__(
    p: float,
    season_length: int,
    window_size: int,
    min_samples: Optional[int] = None
)

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class ExpandingMean

method __init__

__init__()

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class ExpandingStd

method __init__

__init__()

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class ExpandingMin

method __init__

__init__()

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class ExpandingMax

method __init__

__init__()

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class ExpandingQuantile

method __init__

__init__(p: float)

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class ExponentiallyWeightedMean

Exponentially weighted average Args:
  • alpha (float): Smoothing factor.

method __init__

__init__(alpha: float)

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class Offset

Shift series before computing transformation Args:
  • tfm (LagTransform): Transformation to be applied
  • n (int): Number of positions to shift (lag) series before applying the transformation

method __init__

__init__(tfm: _BaseLagTransform, n: int)

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

class Combine

Combine two lag transformations using an operator Args:
  • tfm1 (LagTransform): First transformation.
  • tfm2 (LagTransform): Second transformation.
  • operator (callable): Binary operator that defines how to combine the two transformations.

method __init__

__init__(tfm1: _BaseLagTransform, tfm2: _BaseLagTransform, operator: Callable)

property update_samples


method stack

stack(transforms: Sequence[ForwardRef('_BaseLagTransform')]) → _BaseLagTransform

method take

take(idxs: ndarray) → _BaseLagTransform

method transform

transform(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray

method update

update(
    ga: <built-in method GroupedArray of PyCapsule object at 0x7f2bceb30720>
) → ndarray