{"action":"opened","issue":{"url":"https://api.github.com/repos/numeristical/introspective/issues/13","repository_url":"https://api.github.com/repos/numeristical/introspective","labels_url":"https://api.github.com/repos/numeristical/introspective/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/numeristical/introspective/issues/13/comments","events_url":"https://api.github.com/repos/numeristical/introspective/issues/13/events","html_url":"https://github.com/numeristical/introspective/issues/13","id":190362846,"number":13,"title":"Bug: TypeError in Feature_Dependence_Plots","user":{"login":"CallumMain","id":9487241,"avatar_url":"https://avatars.githubusercontent.com/u/9487241?v=3","gravatar_id":"","url":"https://api.github.com/users/CallumMain","html_url":"https://github.com/CallumMain","followers_url":"https://api.github.com/users/CallumMain/followers","following_url":"https://api.github.com/users/CallumMain/following{/other_user}","gists_url":"https://api.github.com/users/CallumMain/gists{/gist_id}","starred_url":"https://api.github.com/users/CallumMain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CallumMain/subscriptions","organizations_url":"https://api.github.com/users/CallumMain/orgs","repos_url":"https://api.github.com/users/CallumMain/repos","events_url":"https://api.github.com/users/CallumMain/events{/privacy}","received_events_url":"https://api.github.com/users/CallumMain/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-18T16:33:57Z","updated_at":"2016-11-18T16:33:57Z","closed_at":null,"body":"* ML Inspector version: 0.0.6\r\n* Python version: 2.7.12\r\n* Operating System: Amazon Linux\r\n\r\n### Description\r\n\r\nI was trying to create the feature dependence plots for the XGboost model I trained and I ran into a type error.  I believe the issue is due to the fact that math.ceil returns a float in python 2 and an int in python 3.  As a result, we are passing n_rows as a float to the plotting function in matplotlib in python 2.\r\n\r\n### What I Did\r\n\r\nI ran the command\r\n\r\n```\r\nindices = mxr.feature_dependence_plots()\r\n```\r\n\r\nWhich resulted in the following error\r\n```\r\nTypeErrorTraceback (most recent call last)\r\n<ipython-input-32-bee2deb0616f> in <module>()\r\n----> 1 indices = mxr.feature_dependence_plots()\r\n\r\n/home/ec2-user/anaconda2/lib/python2.7/site-packages/ml_insights/insights.pyc in feature_dependence_plots(self, show_base_points, pts_selected, num_pts, figsize)\r\n    270         n_rows = math.ceil(len(columns) / n_cols)\r\n    271         figsize = (n_cols * 4, n_rows * 4)\r\n--> 272         fig, axes = plt.subplots(n_rows, n_cols, figsize=figsize)\r\n    273         for col_name, ax in zip(columns, axes.flatten()):\r\n    274             x = self.results[col_name][0]\r\n\r\n/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/pyplot.pyc in subplots(nrows, ncols, sharex, sharey, squeeze, subplot_kw, gridspec_kw, **fig_kw)\r\n   1184 \r\n   1185     # Create first subplot separately, so we can share it if requested\r\n-> 1186     ax0 = fig.add_subplot(gs[0, 0], **subplot_kw)\r\n   1187     axarr[0] = ax0\r\n   1188 \r\n\r\n/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/figure.pyc in add_subplot(self, *args, **kwargs)\r\n   1003                     self._axstack.remove(ax)\r\n   1004 \r\n-> 1005             a = subplot_class_factory(projection_class)(self, *args, **kwargs)\r\n   1006 \r\n   1007         self._axstack.add(key, a)\r\n\r\n/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_subplots.pyc in __init__(self, fig, *args, **kwargs)\r\n     68             raise ValueError('Illegal argument(s) to subplot: %s' % (args,))\r\n     69 \r\n---> 70         self.update_params()\r\n     71 \r\n     72         # _axes_class is set in the subplot_class_factory\r\n\r\n/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_subplots.pyc in update_params(self)\r\n    112         self.figbox, self.rowNum, self.colNum, self.numRows, self.numCols = \\\r\n    113             self.get_subplotspec().get_position(self.figure,\r\n--> 114                                                 return_all=True)\r\n    115 \r\n    116     def is_first_col(self):\r\n\r\n/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/gridspec.pyc in get_position(self, fig, return_all)\r\n    423 \r\n    424         figBottoms, figTops, figLefts, figRights = \\\r\n--> 425                     gridspec.get_grid_positions(fig)\r\n    426 \r\n    427 \r\n\r\n/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/gridspec.pyc in get_grid_positions(self, fig)\r\n    103             cellHeights = [netHeight*r/tr for r in self._row_height_ratios]\r\n    104         else:\r\n--> 105             cellHeights = [cellH] * nrows\r\n    106 \r\n    107         sepHeights = [0] + ([sepH] * (nrows-1))\r\n\r\nTypeError: can't multiply sequence by non-int of type 'float'\r\n```\r\n"}}
{"actor":{"display_login":"CallumMain"}}