Lesson 14: Box Plots, Heatmaps & Pair Plots

1. Box Plots – Distribution & Outliers

Box plot shows quartiles, median, and outliers.

sns.boxplot(data=df, x="species", y="petal_length")
plt.title("Petal Length by Species")

Used in ML: detect outliers in features, compare distributions.

Exercise 1

What does the box in a box plot represent?

2. Heatmaps – Correlation Matrix

Visualize correlations between features.

corr = df.corr()
sns.heatmap(corr, annot=True, cmap="coolwarm", vmin=-1, vmax=1)
plt.title("Feature Correlation")

Used in ML: drop highly correlated features (multicollinearity).

Exercise 2

To show correlation heatmap:

corr = df.corr()
sns.heatmap(corr, annot=, cmap="")

Exercise 3

Which plots help spot multicollinearity?
← Previous Lesson (13) Next Lesson (15) →