Source code for skfolio.descriptor._profitability._gross_profitability
"""Gross profitability descriptor."""
# Copyright (c) 2023-2026
# Author: Hugo Delatte <hugo.delatte@skfoliolabs.com>
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import numpy as np
from skfolio.containers import AssetPanel
from skfolio.descriptor._base import BaseDescriptor
from skfolio.typing import FloatArray
from skfolio.utils.stats import safe_divide
from skfolio.utils.validation import validate_asset_panel
[docs]
class GrossProfitability(BaseDescriptor, stateless=True):
r"""Gross profitability descriptor.
Computes the ratio of gross profit to total assets:
.. math::
\text{gross\_profitability}(t) =
\frac{\text{sales\_ttm}(t) - \text{cost\_of\_revenue\_ttm}(t)}
{\text{total\_assets}(t)}
Gross profitability captures a firm's ability to generate profit from its asset base
before operating expenses, interest and taxes. It is less affected by financing,
tax and accrual accounting choices than net income-based ratios.
Profitable firms typically earn significantly higher returns than unprofitable ones [1]_.
Parameters
----------
None
Attributes
----------
n_assets_ : int
Number of assets seen during fitting.
asset_names_ : ndarray of shape (n_assets,)
Asset names seen during fitting.
Notes
-----
`cost_of_revenue_ttm` (trailing twelve months) should be reported as a positive
number representing the cost. The descriptor computes
`sales_ttm - cost_of_revenue_ttm` to obtain gross profit.
See Also
--------
GrossMargin : Gross profit normalized by sales.
ReturnOnAssets : Net income normalized by total assets.
References
----------
.. [1] "The other side of value: The gross profitability premium"
Journal of Financial Economics. Novy-Marx, R. (2013).
Examples
--------
>>> from skfolio.datasets import make_synthetic_characteristics
>>> from skfolio.descriptor import GrossProfitability
>>>
>>> X = make_synthetic_characteristics()
>>>
>>> descriptor = GrossProfitability()
>>> gross_profitability = descriptor.fit_transform(X)
"""