Skip to content

Instantly share code, notes, and snippets.

@netsatsawat
Created May 19, 2019 15:40
Show Gist options
  • Save netsatsawat/ac36c90028bba7c8d568117bdc4ba780 to your computer and use it in GitHub Desktop.
Save netsatsawat/ac36c90028bba7c8d568117bdc4ba780 to your computer and use it in GitHub Desktop.
Check the target variable counts in train data set
plt.figure(figsize=(10, 6))
total_ = float(len(y_train))
ax = sns.countplot(y_train)
for p in ax.patches:
height = p.get_height()
ax.text(p.get_x() + p.get_width() / 2.,
height + 10,
'{0:1.1%}'.format(height / total_),
ha='center')
plt.title('Training label distribution', fontsize=16)
plt.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment