Back to models
Transformer

ScaledLogitTransformer

Scaled logit transform or Log transform.

If both lower_bound and upper_bound are not None, a scaled logit transform is applied to the data. Otherwise, the transform applied is a log transform variation that ensures the resulting values from the inverse transform are bounded accordingly. The transform is applied to all scalar elements of the input array individually.

Combined with an sktime.forecasting.compose.TransformedTargetForecaster, it ensures that the forecast stays between the specified bounds (lower_bound, upper_bound).

Default is lower_bound = upper_bound = None, i.e., the identity transform.

The logarithm transform is obtained for lower_bound = 0, upper_bound = None.

Quickstart

python
from sktime.transformations.scaledlogit import ScaledLogitTransformer

estimator = ScaledLogitTransformer(lower_bound=None, upper_bound=None)

Tags

Capabilities

  • Multivariate
  • Inverse transform: Supported
  • Unequal-length series
  • Missing values: Not supported
  • Removes missing values: Not supported
  • Equalizes series length: Not supported

Properties

Input typescitype:transform-input
Series
Output typescitype:transform-output
Series
Label typescitype:transform-labels
None
Fit is emptyfit_is_empty
Yes
Keeps the time indextransform-returns-same-time-index
Yes
Requires Xrequires_X
Yes
Requires yrequires_y
No
X and y need the same indexX-y-must-have-same-index
No

Parameters(2)

lower_boundfloat, optional, default=None
lower bound of inverse transform function
upper_boundfloat, optional, default=None
upper bound of inverse transform function

Examples

>>> import numpy as np
>>> from sktime.datasets import load_airline
>>> from sktime.transformations.scaledlogit import ScaledLogitTransformer
>>> from sktime.forecasting.trend import PolynomialTrendForecaster
>>> from sktime.forecasting.compose import TransformedTargetForecaster
>>> y = load_airline ()
>>> fcaster = TransformedTargetForecaster ([
... ("scaled_logit", ScaledLogitTransformer (0, 650)),
... ("poly", PolynomialTrendForecaster (degree = 2))
... ])
>>> fcaster. fit (y) TransformedTargetForecaster(
... )
>>> y_pred = fcaster. predict (fh = np. arange (32))

References

[1]

Hyndsight - Forecasting within limits: https://robjhyndman.com/hyndsight/forecasting-within-limits/

[2]

Hyndman, R.J., & Athanasopoulos, G. (2021) Forecasting: principles and practice, 3rd edition, OTexts: Melbourne, Australia. OTexts.com/fpp3. Accessed on January 24th 2022.