<a id="skfolio-descriptor-capextoassetschangeinintensity"></a>

# skfolio.descriptor.CapexToAssetsChangeInIntensity

<a id="skfolio.descriptor.CapexToAssetsChangeInIntensity"></a>

### *class* skfolio.descriptor.CapexToAssetsChangeInIntensity(lag=252)

Lagged change in capex-to-assets intensity.

Computes the change in the capex-to-assets ratio over a fixed lag:

$$
\text{capex\_to\_assets\_change\_in\_intensity}(t)
= \frac{\text{capex\_ttm}(t)}{\text{total\_assets}(t)}
- \frac{\text{capex\_ttm}(t - \text{lag})}
       {\text{total\_assets}(t - \text{lag})}
$$

The first `lag` observations are NaN because no lagged history is available.

NaNs are allowed as missing observations and propagate when the current, lagged or
scale value is missing. Non-missing `capex_ttm` values must be finite.
Non-missing `total_assets` values must be finite and strictly positive.

A positive value indicates that capex intensity increased relative to total assets
and a negative value indicates that it decreased.

This is a convenience subclass of [`ChangeInIntensity`](https://skfolio.org/generated/skfolio.descriptor.ChangeInIntensity.html.md#skfolio.descriptor.ChangeInIntensity) with
`field="capex_ttm"` and `scale_field="total_assets"`.

* **Parameters:**
  **lag** *int, default=252*
  : Number of observations to look back. The interpretation depends on the data
    frequency: `lag=12` means 1 year for monthly data, `lag=252` for daily data,
    `lag=4` for 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_in_intensity_** *ndarray of shape (n_assets,)*
  : Last capex-to-assets intensity change for each asset.

### Methods

| [`fit_transform`](#skfolio.descriptor.CapexToAssetsChangeInIntensity.fit_transform)(X[, y])         | Compute changes in the intensity ratio over the configured lag.   |
|--------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [`get_metadata_routing`](#skfolio.descriptor.CapexToAssetsChangeInIntensity.get_metadata_routing)()        | Get metadata routing of this object.                              |
| [`get_params`](#skfolio.descriptor.CapexToAssetsChangeInIntensity.get_params)([deep])            | Get parameters for this estimator.                                |
| [`partial_fit_transform`](#skfolio.descriptor.CapexToAssetsChangeInIntensity.partial_fit_transform)(X[, y]) | Compute changes in the intensity ratio over the configured lag.   |
| [`set_params`](#skfolio.descriptor.CapexToAssetsChangeInIntensity.set_params)(\*\*params)        | Set the parameters of this estimator.                             |

#### SEE ALSO
[`ChangeInIntensity`](https://skfolio.org/generated/skfolio.descriptor.ChangeInIntensity.html.md#skfolio.descriptor.ChangeInIntensity)
: Generic field-to-scale intensity change descriptor.

[`GrowthRate`](https://skfolio.org/generated/skfolio.descriptor.GrowthRate.html.md#skfolio.descriptor.GrowthRate)
: Period-over-period growth rate for non-negative fields.

### Examples

```pycon
>>> from skfolio.datasets import make_synthetic_characteristics
>>> from skfolio.descriptor import CapexToAssetsChangeInIntensity
>>>
>>> X = make_synthetic_characteristics()
>>>
>>> descriptor = CapexToAssetsChangeInIntensity(lag=252)
>>> capex_intensity_change = descriptor.fit_transform(X)
```

<a id="skfolio.descriptor.CapexToAssetsChangeInIntensity.fit_transform"></a>

#### fit_transform(X, y=None, \*\*fit_params)

Compute changes in the intensity ratio over the configured lag.

* **Parameters:**
  **X** *AssetPanel*
  : Input panel containing the `field` and `scale_field` characteristics
    configured at construction.

  **y** *None*
  : Ignored. Present for compatibility with scikit-learn’s API.

  **\*\*fit_params** *dict*
  : Additional fit parameters. Ignored.
* **Returns:**
  **change_in_intensity** *ndarray of shape (n_observations, n_assets)*
  : Change in `field` / `scale_field` over the lag window for each observation
    and asset.

<a id="skfolio.descriptor.CapexToAssetsChangeInIntensity.get_metadata_routing"></a>

#### get_metadata_routing()

Get metadata routing of this object.

Please check [User Guide](https://skfolio.org/user_guide/metadata_routing.html.md#metadata-routing) on how the routing
mechanism works.

* **Returns:**
  **routing** *MetadataRequest*
  : A `MetadataRequest` encapsulating
    routing information.

<a id="skfolio.descriptor.CapexToAssetsChangeInIntensity.get_params"></a>

#### get_params(deep=True)

Get parameters for this estimator.

* **Parameters:**
  **deep** *bool, default=True*
  : If True, will return the parameters for this estimator and
    contained subobjects that are estimators.
* **Returns:**
  **params** *dict*
  : Parameter names mapped to their values.

<a id="skfolio.descriptor.CapexToAssetsChangeInIntensity.partial_fit_transform"></a>

#### partial_fit_transform(X, y=None, \*\*fit_params)

Compute changes in the intensity ratio over the configured lag.

This method supports online updates by continuing from the current fitted state.
Use `fit_transform` to start from a clean state.

* **Parameters:**
  **X** *AssetPanel*
  : Input panel containing the `field` and `scale_field` fields configured at
    construction.

  **y** *None*
  : Ignored. Present for compatibility with scikit-learn’s API.

  **\*\*fit_params** *dict*
  : Additional fit parameters. Ignored.
* **Returns:**
  **change_in_intensity** *ndarray of shape (n_observations, n_assets)*
  : Change in `field` / `scale_field` over the lag window for each observation
    and asset.

<a id="skfolio.descriptor.CapexToAssetsChangeInIntensity.set_params"></a>

#### 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:**
  **\*\*params** *dict*
  : Estimator parameters.
* **Returns:**
  **self** *estimator instance*
  : Estimator instance.

