Skip to content

Plots

fyt.utils.plots

create_feature_importance_plot(importance_df, output_path, method_name='Feature Importance', figsize=None)

Create and save a feature importance plot with per-feature legend.

Parameters:

Name Type Description Default
importance_df DataFrame

DataFrame with 'feature' and 'importance' columns.

required
output_path str | Path

Destination path for the saved HTML plot.

required
method_name str

Name of the importance method, shown in the plot title.

'Feature Importance'
figsize tuple[float, float] | None

Figure size as (width, height) in inches. When None, the size is computed automatically from the number of features.

None

Returns:

Type Description
Path

Path to the saved HTML plot file.

Raises:

Type Description
ValueError

If importance_df lacks the 'feature' and 'importance' columns.