Loading...

vastorbit.machine_learning.vast.tsa.AR.features_importance

AR.features_importance(idx: int = 0, show: bool = True, chart: PlottingBase | TableSample | Axes | mFigure | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Figure | TableSample

Computes the model’s features importance.

For AR/VAR models, feature importance is based on the magnitude of the autoregressive coefficients (phi).

Parameters:
  • show (bool) – If set to True, draw the feature’s importance.

  • chart (PlottingObject, optional) – The chart object to plot on.

  • **style_kwargs – Any optional parameter to pass to the Plotting functions.

Returns:

Features importance.

Return type:

obj

Examples

We import vastorbit:

import vastorbit as vo

For this example, we will use the airline passengers dataset.

import vastorbit.datasets as vod
data = vod.load_airline_passengers()

First we import the model:

from vastorbit.machine_learning.vast.tsa import AR

Then we can create the model:

model = AR(p=5)

We can now fit the model:

model.fit(data, "date", "passengers")

We can conveniently get the features importance:

result = model.features_importance()

Important

For this example, a specific model is utilized, and it may not correspond exactly to the model you are working with. To see a comprehensive example specific to your class of interest, please refer to that particular class.