Skip to content

Commit

Permalink
Remove pie chart for negative coefficients; set normalize to true
Browse files Browse the repository at this point in the history
  • Loading branch information
aloukina committed Sep 28, 2020
1 parent f9c3f58 commit 619d9fa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rsmtool/notebooks/builtin_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@
" ax1.set_title('Values of standardized coefficients')\n",
" ax1.set_xlabel('')\n",
" ax1.set_ylabel('')\n",
" # no pie chart if we have more than 15 features or if the feature names are long (pie chart looks ugly)\n",
" if len(features_used) <= 15 and longest_feature_name <= 10:\n",
" # no pie chart if we have more than 15 features,\n",
" # if the feature names are long (pie chart looks ugly)\n",
" # or if there are any negative coefficients.\n",
" if len(features_used) <= 15 and longest_feature_name <= 10 and (df_betas_sorted['relative']>=0).all():\n",
" ax2=fig.add_subplot(133, aspect=True)\n",
" # we set normalize to False to make sure we have a partial pie in case \n",
" # of negative coefficients.\n",
" ax2.pie(abs(df_betas_sorted['relative'].values), colors=grey_colors, \n",
" labels=df_betas_sorted['feature'].values, normalize=False)\n",
" labels=df_betas_sorted['feature'].values, normalize=True)\n",
" ax2.set_title('Proportional contribution of each feature')\n",
" else:\n",
" fig.set_size_inches(len(features_used), 3)\n",
Expand Down

0 comments on commit 619d9fa

Please sign in to comment.