[function] plot_feature_importance() - P3chys/textmining GitHub Wiki

4. Visualization Functions

Function: plot_feature_importance()

Purpose

Visualizes feature importance scores in a horizontal bar chart.

Syntax

plot_feature_importance(feature_names, weights, top_n=20, title="Top Important Features")

Parameters

Parameter Type Default Description
feature_names array Required List of feature names
weights array Required Feature weights/coefficients
top_n int 20 Number of top features to display
title str "Top Important Features" Plot title

Output

  • Saves plot as 'feature_importance.png'