Created
July 22, 2021 05:50
-
-
Save therealnaveenkamal/c82a8f9c4d250653db85d1c1a50951e7 to your computer and use it in GitHub Desktop.
This code provides an effective solution to remove class imbalance problem
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
data = { | |
'Class': labels, | |
'Positive': positive_freqs*negative_freqs, | |
'Negative':negative_freqs*positive_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