Scalers
module coreforecast.scalers
Global Variables
- TYPE_CHECKING
function boxcox_lambda
Find optimum lambda for the Box-Cox transformation
Args:
x
(np.ndarray): Array with data to transform.method
(str): Method to use. Valid options are ‘guerrero’ and ‘loglik’. ‘guerrero’ minimizes the coefficient of variation for subseries ofx
and supports negative values. ‘loglik’ maximizes the log-likelihood function.season_length
(int, optional): Length of the seasonal period. Only required if method=‘guerrero’.lower
(float): Lower bound for the lambda.upper
(float): Upper bound for the lambda.
Returns:
float
: Optimum lambda.
function boxcox
Apply the Box-Cox transformation
Args:
x
(np.ndarray): Array with data to transform.lmbda
(float): Lambda value to use.
Returns:
np.ndarray
: Array with the transformed data.
function inv_boxcox
Invert the Box-Cox transformation
Args:
x
(np.ndarray): Array with data to transform.lmbda
(float): Lambda value to use.
Returns:
np.ndarray
: Array with the inverted transformation.
class LocalMinMaxScaler
Scale each group to the [0, 1] interval
method fit
Compute the statistics for each group.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
self
: The fitted scaler object.
method fit_transform
”Compute the statistics for each group and apply the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
method inverse_transform
Use the computed statistics to invert the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the inverted transformation.
method stack
method take
method transform
Use the computed statistics to apply the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
class LocalStandardScaler
Scale each group to have zero mean and unit variance
method fit
Compute the statistics for each group.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
self
: The fitted scaler object.
method fit_transform
”Compute the statistics for each group and apply the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
method inverse_transform
Use the computed statistics to invert the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the inverted transformation.
method stack
method take
method transform
Use the computed statistics to apply the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
class LocalRobustScaler
Scale each group using robust statistics
Args:
scale
(str): Type of robust scaling to use. Valid options are ‘iqr’ and ‘mad’. If ‘iqr’ will use the inter quartile range as the scale. If ‘mad’ will use median absolute deviation as the scale.
method __init__
method fit
Compute the statistics for each group.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
self
: The fitted scaler object.
method fit_transform
”Compute the statistics for each group and apply the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
method inverse_transform
Use the computed statistics to invert the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the inverted transformation.
method stack
method take
method transform
Use the computed statistics to apply the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
class LocalBoxCoxScaler
Find the optimum lambda for the Box-Cox transformation by group and apply it
Args:
season_length
(int, optional): Length of the seasonal period. Only required if method=‘guerrero’.lower
(float): Lower bound for the lambda.upper
(float): Upper bound for the lambda.method
(str): Method to use. Valid options are ‘guerrero’ and ‘loglik’. ‘guerrero’ minimizes the coefficient of variation for subseries ofx
and supports negative values. ‘loglik’ maximizes the log-likelihood function.
method __init__
method fit
Compute the statistics for each group.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
self
: The fitted scaler object.
method fit_transform
”Compute the statistics for each group and apply the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
method inverse_transform
Use the computed lambdas to invert the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the inverted transformation.
method stack
method take
method transform
Use the computed lambdas to apply the transformation.
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
class Difference
Subtract a lag to each group
Args:
d
(int): Lag to subtract.
method __init__
method fit_transform
Apply the transformation
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
method inverse_transform
Invert the transformation
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the inverted transformation.
method stack
method take
method update
Update the last observations from each serie
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the updated data.
class AutoDifferences
Find and apply the optimal number of differences to each group.
Args:
max_diffs
(int): Maximum number of differences to apply.
method __init__
method fit_transform
Compute and apply the optimal number of differences for each group
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
method inverse_transform
Invert the differences
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the inverted transformation.
method stack
method take
method update
Update the last observations from each serie
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the updated data.
class AutoSeasonalDifferences
Find and apply the optimal number of seasonal differences to each group.
Args:
season_length
(int): Length of the seasonal period.max_diffs
(int): Maximum number of differences to apply.n_seasons
(int | None): Number of seasons to use to determine the number of differences. Defaults to 10. IfNone
will use all samples, otherwiseseason_length
*n_seasons
samples will be used for the test. Smaller values will be faster but could be less accurate.
method __init__
method fit_transform
Compute and apply the optimal number of seasonal differences for each group
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
method inverse_transform
Invert the seasonal differences
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the inverted transformation.
method stack
method take
method update
Update the last observations from each serie
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the updated data.
class AutoSeasonalityAndDifferences
Find the length of the seasonal period and apply the optimal number of differences to each group.
Args:
max_season_length
(int): Maximum length of the seasonal period.max_diffs
(int): Maximum number of differences to apply.n_seasons
(int | None): Number of seasons to use to determine the number of differences. Defaults to 10. IfNone
will use all samples, otherwisemax_season_length
*n_seasons
samples will be used for the test. Smaller values will be faster but could be less accurate.
method __init__
method fit_transform
Compute the optimal length of the seasonal period and apply the optimal number of differences for each group
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the transformed data.
method inverse_transform
Invert the seasonal differences
Args:
ga
(GroupedArray): Array with grouped data.
Returns:
np.ndarray
: Array with the inverted transformation.
method stack
method take
method update
This file was automatically generated via lazydocs.