Skip to content

Commit

Permalink
plots look good now
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryanglambert committed Mar 28, 2018
1 parent c70a61c commit 88289ab
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -14,6 +14,7 @@ ModelNet40/
ModelNet40.zip.1
ModelNet40.zip
results_bak
dont_track/*
binvox
viewvox
*.log
Binary file modified ModelNet10_class_imbalance.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed ModelNet40.png
Binary file not shown.
Binary file added ModelNet40_class_imbalance.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion count_files.py
Expand Up @@ -32,14 +32,16 @@ def make_file_description_data_frame(path='./ModelNet10/', show_missed=True):
return pd.DataFrame(paths)


def plot_unbalanced_classes(df, title, display_df=False):
def plot_unbalanced_classes(df, title, display_df=False, save=False):
grouped = df.groupby(['class', 'type'])['type'].count()
unstacked = grouped.unstack()
plt.figure()
unstacked = unstacked.sort_values(['test', 'train'])
unstacked.plot(kind='bar', title=title, figsize=(10, 6), yticks=np.arange(0, unstacked['train'].max(), 100))
plt.ylabel('Number of Samples')
# plt.grid()
if save:
plt.savefig(title + '.png')
plt.show()
if display_df:
display(unstacked)

0 comments on commit 88289ab

Please sign in to comment.