Created
July 22, 2021 05:40
-
-
Save therealnaveenkamal/0ce6a03a45370c24acd62394083cbac4 to your computer and use it in GitHub Desktop.
This code is to visualize the balance between the positive and the negative values of each class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
positive_freqs = np.mean(traingenerator.labels, axis = 0) | |
negative_freqs = 1 - positive_freqs | |
data = { | |
'Class': labels, | |
'Positive': positive_freqs, | |
'Negative':negative_freqs | |
} | |
X_axis = np.arange(len(labels)) | |
fig, ax = plt.subplots(figsize=(10, 5)) | |
ax.bar(X_axis-0.2, data['Positive'], width=0.4, color='b', label = "Positive") | |
ax.bar(X_axis+0.2, data['Negative'], width=0.4, color='r', label = 'Negative') | |
plt.xticks(X_axis, labels, rotation = 90) | |
plt.legend() | |
plt.figure(figsize=(20,15)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment