skfolio.descriptor.EarningsChangeToPrice#
- class skfolio.descriptor.EarningsChangeToPrice(lag=252)[source]#
Lagged earnings change divided by current market capitalization.
Computes the change in trailing twelve-month net income over a fixed lag, divided by current market capitalization:
\[\text{earnings\_change\_to\_price}(t) = \frac{\text{net\_income\_ttm}(t) - \text{net\_income\_ttm}(t - \text{lag})} {\text{market\_cap}(t)}\]The first
lagobservations are NaN because no lagged history is available.NaNs are allowed as missing observations and propagate when the current, lagged or market-cap value is missing. Non-missing
net_income_ttmvalues must be finite. Non-missingmarket_capvalues must be finite and strictly positive.This descriptor captures earnings momentum: whether a firm’s profitability is improving or deteriorating relative to its market value [1]. A positive value indicates earnings improvement and a negative value indicates deterioration.
Unlike
GrowthRate, which computesx(t) / x(t-lag) - 1, this formulation is well-defined when earnings are negative. A standard growth rate with a negative base produces sign-inverted rankings, making it unsuitable for earnings. By normalizing the level change with market capitalization, the sign of the output reflects the direction of change.This is a convenience subclass of
ChangeToScalewithfield="net_income_ttm"andscale_field="market_cap".This descriptor uses aggregate quantities (net income and market capitalization). The per-share equivalent is:
\[\frac{\text{eps\_ttm}(t) - \text{eps\_ttm}(t - \text{lag})} {\text{adj\_close}(t)}\]The aggregate form is preferred for consistency with the other value descriptors and to avoid split-adjustment mismatches.
- 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.
- change_to_scale_ndarray of shape (n_assets,)
Last earnings change to price value for each asset.
Methods
fit_transform(X[, y])Compute changes in level normalized by current scale.
Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
partial_fit_transform(X[, y])Compute changes in level normalized by current scale.
set_params(**params)Set the parameters of this estimator.
See also
ChangeToScaleGeneric change-to-scale descriptor.
GrowthRateSimple growth rate for positive-definite characteristics.
EarningsToPriceLevel of trailing earnings to price (value signal).
References
[1]Fama, E. F., & French, K. R. (2006). “Profitability, investment and average returns.” Journal of Financial Economics, 82(3), 491-518.
Examples
>>> from skfolio.datasets import make_synthetic_characteristics >>> from skfolio.descriptor import EarningsChangeToPrice >>> >>> X = make_synthetic_characteristics() >>> >>> descriptor = EarningsChangeToPrice(lag=252) >>> earnings_change_to_price = descriptor.fit_transform(X)
- fit_transform(X, y=None, **fit_params)#
Compute changes in level normalized by current scale.
- Parameters:
- XAssetPanel
Input panel containing the
fieldandscale_fieldcharacteristics configured at construction.- yNone
Ignored. Present for compatibility with scikit-learn’s API.
- **fit_paramsdict
Additional fit parameters. Ignored.
- Returns:
- change_to_scalendarray of shape (n_observations, n_assets)
Change in
fieldover the lag window, divided by currentscale_fieldfor 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 changes in level normalized by current scale.
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
fieldandscale_fieldfields configured at construction.- yNone
Ignored. Present for compatibility with scikit-learn’s API.
- **fit_paramsdict
Additional fit parameters. Ignored.
- Returns:
- change_to_scalendarray of shape (n_observations, n_assets)
Change in
fieldover the lag window, divided by currentscale_fieldfor 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.