Plots the distribution of class labels in a dataset. Args: y (array-like): Target labels.
(y)
| 123 | |
| 124 | |
| 125 | def plot_class_distribution(y): |
| 126 | """ |
| 127 | Plots the distribution of class labels in a dataset. |
| 128 | |
| 129 | Args: |
| 130 | y (array-like): Target labels. |
| 131 | """ |
| 132 | unique, counts = np.unique(y, return_counts=True) |
| 133 | |
| 134 | plt.figure(figsize=(8, 5)) |
| 135 | plt.bar(unique.astype(str), counts, color="salmon") |
| 136 | plt.xlabel("Class Labels") |
| 137 | plt.ylabel("Frequency") |
| 138 | plt.title("Class Distribution") |
| 139 | plt.grid(axis="y", linestyle="--", alpha=0.7) |
| 140 | plt.show() |
| 141 | |
| 142 | |
| 143 | def plot_correlation_matrix(df): |
nothing calls this directly
no outgoing calls
no test coverage detected