You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is very helpful to use Interpret ML which can define explanations. I firstly use 17 features to do prediction via EBM regression, and EBM could show global explainations. However, when I using all the features (i.e., 76 features) to regress, I get the error, "list index out of range". How can I solve this problem?
Hi @Ricky-zhang9678 -- I believe this is being triggered if one of the input features has values above 999000000000000 (999T). I'll fix this in the future, but for now I'd recommend fixing these issues by limiting the range of the inputs either by establishing a maximum ceiling or by scaling.
It is very helpful to use Interpret ML which can define explanations. I firstly use 17 features to do prediction via EBM regression, and EBM could show global explainations. However, when I using all the features (i.e., 76 features) to regress, I get the error, "list index out of range". How can I solve this problem?
IndexError Traceback (most recent call last)
Input In [16], in <cell line: 119>()
115 print('r2 score = %0.2f ± %0.2f' % (mean_r2_score, std_r2_score))
118 ebm_global = ebm.explain_global()
--> 119 show(ebm_global)
122 ebm_local = ebm.explain_local(X_test[:5], y_test[:5])
123 show(ebm_local)
File D:\anaconda\lib\site-packages\interpret\visual\interactive.py:172, in show(explanation, key, **kwargs)
170 except Exception as e: # pragma: no cover
171 log.error(e, exc_info=True)
--> 172 raise e
174 return None
File D:\anaconda\lib\site-packages\interpret\visual\interactive.py:169, in show(explanation, key, **kwargs)
166 this.visualize_provider = AutoVisualizeProvider()
168 # Render
--> 169 this.visualize_provider.render(explanation, key=key, **kwargs)
170 except Exception as e: # pragma: no cover
171 log.error(e, exc_info=True)
File D:\anaconda\lib\site-packages\interpret\provider\visualize.py:224, in InlineProvider.render(self, explanation, key, **kwargs)
221 def render(self, explanation, key=-1, **kwargs):
222 from ..visual.inline import render
--> 224 render(
225 explanation,
226 default_key=key,
227 detected_envs=self.detected_envs,
228 js_url=self.js_url,
229 )
File D:\anaconda\lib\site-packages\interpret\visual\inline.py:216, in render(explanation, id_str, default_key, detected_envs, js_url)
214 viz_obj = _build_viz_err_obj(msg)
215 else:
--> 216 viz_obj = _build_viz_obj(explanation)
218 init_js, body_js = _build_javascript(
219 viz_obj, id_str, default_key=default_key, js_url=js_url
220 )
222 if "databricks" in detected_envs:
File D:\anaconda\lib\site-packages\interpret\visual\inline.py:100, in _build_viz_obj(explanation)
98 selector_obj = {"columns": [], "data": []}
99 else:
--> 100 specific = [
101 _build_viz_figure(explanation.visualize(i))
102 for i in range(len(explanation.selector))
103 ]
104 selector_obj = {
105 "columns": list(explanation.selector.columns),
106 "data": explanation.selector.to_dict("records"),
107 }
109 viz_obj = {
110 "name": explanation.name,
111 "overall": overall,
112 "specific": specific,
113 "selector": selector_obj,
114 }
File D:\anaconda\lib\site-packages\interpret\visual\inline.py:101, in (.0)
98 selector_obj = {"columns": [], "data": []}
99 else:
100 specific = [
--> 101 _build_viz_figure(explanation.visualize(i))
102 for i in range(len(explanation.selector))
103 ]
104 selector_obj = {
105 "columns": list(explanation.selector.columns),
106 "data": explanation.selector.to_dict("records"),
107 }
109 viz_obj = {
110 "name": explanation.name,
111 "overall": overall,
112 "specific": specific,
113 "selector": selector_obj,
114 }
File D:\anaconda\lib\site-packages\interpret\glassbox\ebm\ebm.py:120, in EBMExplanation.visualize(self, key)
116 figure = plot_continuous_bar(
117 data_dict, multiclass=True, show_error=False, title=title
118 )
119 else:
--> 120 figure = plot_continuous_bar(data_dict, title=title)
122 return figure
124 return super().visualize(key)
File D:\anaconda\lib\site-packages\interpret\visual\plot.py:192, in plot_continuous_bar(data_dict, multiclass, show_error, title, xtitle, ytitle)
190 # Add density
191 if data_dict.get("density", None) is not None:
--> 192 figure = _plot_with_density(
193 data_dict["density"], main_fig, title=title, yrange=yrange, showlegend=show_legend
194 )
195 else:
196 figure = main_fig
File D:\anaconda\lib\site-packages\interpret\visual\plot.py:289, in _plot_with_density(data_dict, main_fig, title, xtitle, ytitle, yrange, is_categorical, density_name, showlegend)
277 def _plot_with_density(
278 data_dict,
279 main_fig,
(...)
286 showlegend=False,
287 ):
--> 289 bar_fig = plot_density(
290 data_dict, name=density_name, is_categorical=is_categorical, color=COLORS[1]
291 )
292 figure = _two_plot(main_fig, bar_fig, title=title, share_xaxis=is_categorical, showlegend=showlegend)
293 figure["layout"]["yaxis1"].update(title="Score")
File D:\anaconda\lib\site-packages\interpret\visual\plot.py:251, in plot_density(data_dict, title, xtitle, ytitle, is_categorical, name, color)
248 new_x = []
249 for indx in range(len(edges) - 1):
250 new_val = "{0} - {1}".format(
--> 251 _pretty_number(edges[indx]), _pretty_number(edges[indx + 1])
252 )
253 new_x.append(new_val)
254 else:
File D:\anaconda\lib\site-packages\interpret\visual\plot.py:220, in _pretty_number(x)
218 return x
219 # return round(x, rounding)
--> 220 return _human_format(x)
File D:\anaconda\lib\site-packages\interpret\visual\plot.py:210, in _human_format(num)
207 magnitude += 1
208 num /= 1000.0
209 return "{}{}".format(
--> 210 "{:f}".format(num).rstrip("0").rstrip("."), ["", "K", "M", "B", "T"][magnitude]
211 )
IndexError: list index out of range
The text was updated successfully, but these errors were encountered: