plot_collinearity_matrix

plot_collinearity_matrix(df, input_cols, ax=None)

Plots a Pearson correlation matrix heatmap of the input variables to visualize collinearity.

The diagonal is masked (shown in green) so it does not affect the colour scale, and every cell is annotated with its coefficient.

Parameters

Name Type Description Default
df pd.DataFrame The data containing the input columns. required
input_cols list Names of the input columns to correlate. required
ax plt.Axes Axes to draw on; a colour bar is added to its figure. Defaults to None (a new figure is created). None

Returns

Name Type Description
plt.Axes plt.Axes: The axes drawn on (the given ax, or a new one on a new figure).