skfolio.descriptor.SalesGrowthRate#
- class skfolio.descriptor.SalesGrowthRate(lag=252)[source]#
Sales growth rate descriptor.
Computes period-over-period growth in trailing twelve-month sales:
\[\text{sales\_growth}(t) = \frac{\text{sales\_ttm}(t)}{\text{sales\_ttm}(t - \text{lag})} - 1\]The first
lagobservations are NaN because no lagged history is available.sales_ttmmust contain non-missing finite non-negative values. NaNs are allowed as missing observations and propagate when either the current or lagged value is missing. Zero values are allowed and a zero lagged value makes the growth rate undefined and produces NaN.Sales growth measures top-line expansion over the lag window. For TTM sales with a one-year lag, the two observations cover non-overlapping fiscal content.
This is a convenience subclass of
GrowthRatewithfield="sales_ttm".- Parameters:
- lagint, default=252
Number of observations to look back. The interpretation depends on the data frequency:
lag=12means 1 year for monthly data,lag=252for daily data,lag=4for quarterly data.
- Attributes:
- n_assets_int
Number of assets seen during fitting.
- asset_names_ndarray of shape (n_assets,)
Asset names seen during fitting.
- growth_rate_ndarray of shape (n_assets,)
Last sales growth value for each asset.
Methods
fit_transform(X[, y])Compute simple growth rates of the configured field.
Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
partial_fit_transform(X[, y])Compute simple growth rates of the configured field.
set_params(**params)Set the parameters of this estimator.
See also
GrowthRateGeneric period-over-period growth rate descriptor.
Examples
>>> from skfolio.datasets import make_synthetic_characteristics >>> from skfolio.descriptor import SalesGrowthRate >>> >>> X = make_synthetic_characteristics() >>> >>> descriptor = SalesGrowthRate(lag=252) >>> sales_growth_rate = descriptor.fit_transform(X)
- fit_transform(X, y=None, **fit_params)#
Compute simple growth rates of the configured field.
- Parameters:
- XAssetPanel
Input panel containing the
fieldcharacteristic configured at construction.- yNone
Ignored. Present for compatibility with scikit-learn’s API.
- **fit_paramsdict
Additional fit parameters. Ignored.
- Returns:
- growth_ratendarray of shape (n_observations, n_assets)
Period-over-period growth rate for each observation and asset.
- get_metadata_routing()#
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
- routingMetadataRequest
A
MetadataRequestencapsulating routing information.
- get_params(deep=True)#
Get parameters for this estimator.
- Parameters:
- deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns:
- paramsdict
Parameter names mapped to their values.
- partial_fit_transform(X, y=None, **fit_params)#
Compute simple growth rates of the configured field.
This method supports online updates by continuing from the current fitted state. Use
fit_transformto start from a clean state.- Parameters:
- XAssetPanel
Input panel containing the
fieldcharacteristic configured at construction.- yNone
Ignored. Present for compatibility with scikit-learn’s API.
- **fit_paramsdict
Additional fit parameters. Ignored.
- Returns:
- growth_ratendarray of shape (n_observations, n_assets)
Period-over-period growth rate for each observation and asset.
- set_params(**params)#
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline). The latter have parameters of the form<component>__<parameter>so that it’s possible to update each component of a nested object.- Parameters:
- **paramsdict
Estimator parameters.
- Returns:
- selfestimator instance
Estimator instance.