FloatingPointError: underflow encountered in true_divide
xingyuezhiji opened this issue · 2 comments
xingyuezhiji commented
FloatingPointError: underflow encountered in true_divide
how to solve this problem?
xingyuezhiji commented
FloatingPointError Traceback (most recent call last)
/data/lib/anaconda3/lib/python3.9/site-packages/IPython/core/formatters.py in __call__(self, obj, include, exclude)
968
969 if method is not None:
--> 970 return method(include=include, exclude=exclude)
971 return None
972 else:
/data/lib/anaconda3/lib/python3.9/site-packages/panel/viewable.py in _repr_mimebundle_(self, include, exclude)
614 doc = _Document()
615 comm = state._comm_manager.get_server_comm()
--> 616 model = self._render_model(doc, comm)
617 ref = model.ref['id']
618 manager = CommManager(comm_id=comm.id, plot_id=ref)
/data/lib/anaconda3/lib/python3.9/site-packages/panel/viewable.py in _render_model(self, doc, comm)
453 if comm is None:
454 comm = state._comm_manager.get_server_comm()
--> 455 model = self.get_root(doc, comm)
456
457 if config.embed:
/data/lib/anaconda3/lib/python3.9/site-packages/panel/pane/base.py in get_root(self, doc, comm, preprocess)
267 root = self._get_model(doc, comm=comm)
268 else:
--> 269 root = self.layout._get_model(doc, comm=comm)
270 if preprocess:
271 self._preprocess(root)
/data/lib/anaconda3/lib/python3.9/site-packages/panel/layout/base.py in _get_model(self, doc, root, parent, comm)
120 if root is None:
121 root = model
--> 122 objects = self._get_objects(model, [], doc, root, comm)
123 props = dict(self._init_params(), objects=objects)
124 model.update(**self._process_param_change(props))
/data/lib/anaconda3/lib/python3.9/site-packages/panel/layout/base.py in _get_objects(self, model, old_objects, doc, root, comm)
110 else:
111 try:
--> 112 child = pane._get_model(doc, root, model, comm)
113 except RerenderError:
114 return self._get_objects(model, current_objects[:i], doc, root, comm)
/data/lib/anaconda3/lib/python3.9/site-packages/panel/pane/holoviews.py in _get_model(self, doc, root, parent, comm)
237 plot = self.object
238 else:
--> 239 plot = self._render(doc, comm, root)
240
241 plot.pane = self
/data/lib/anaconda3/lib/python3.9/site-packages/panel/pane/holoviews.py in _render(self, doc, comm, root)
310 kwargs['comm'] = comm
311
--> 312 return renderer.get_plot(self.object, **kwargs)
313
314 def _cleanup(self, root):
/data/lib/anaconda3/lib/python3.9/site-packages/holoviews/plotting/bokeh/renderer.py in get_plot(self_or_cls, obj, doc, renderer, **kwargs)
71 combining the bokeh model with another plot.
72 """
---> 73 plot = super(BokehRenderer, self_or_cls).get_plot(obj, doc, renderer, **kwargs)
74 if plot.document is None:
75 plot.document = Document() if self_or_cls.notebook_context else curdoc()
/data/lib/anaconda3/lib/python3.9/site-packages/holoviews/plotting/renderer.py in get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
241 init_key = tuple(v if d is None else d for v, d in
242 zip(plot.keys[0], defaults))
--> 243 plot.update(init_key)
244 else:
245 plot = obj
/data/lib/anaconda3/lib/python3.9/site-packages/holoviews/plotting/plot.py in update(self, key)
989 def update(self, key):
990 if len(self) == 1 and ((key == 0) or (key == self.keys[0])) and not self.drawn:
--> 991 return self.initialize_plot()
992 item = self.__getitem__(key)
993 self.traverse(lambda x: setattr(x, '_updated', True))
/data/lib/anaconda3/lib/python3.9/site-packages/holoviews/plotting/bokeh/element.py in initialize_plot(self, ranges, plot, plots, source)
1416 self.handles['plot'] = plot
1417
-> 1418 self._init_glyphs(plot, element, ranges, source)
1419 if not self.overlaid:
1420 self._update_plot(key, plot, style_element)
/data/lib/anaconda3/lib/python3.9/site-packages/holoviews/plotting/bokeh/element.py in _init_glyphs(self, plot, element, ranges, source, data, mapping, style)
1603 if None in (data, mapping):
1604 style = self.style[self.cyclic_index]
-> 1605 data, mapping, style = self.get_data(element, ranges, style)
1606
1607 keys = glyph_order(dict(data, **mapping), self._draw_order)
/data/lib/anaconda3/lib/python3.9/site-packages/holoviews/plotting/bokeh/stats.py in get_data(self, element, ranges, style)
553 if element.kdims:
554 key = tuple(d.pprint_value(k) for d, k in zip(element.kdims, key))
--> 555 kde, line, segs, bars, scatter = self._kde_data(
556 element, g, key, split_dim, split_cats, **kwargs
557 )
/data/lib/anaconda3/lib/python3.9/site-packages/holoviews/plotting/bokeh/stats.py in _kde_data(self, element, el, key, split_dim, split_cats, **kwargs)
454 fill_ys = [[key + (y,) for y in (fy/np.abs(ys).max())*(self.violin_width/scale)]
455 if len(fy) else [] for fy in fill_ys]
--> 456 ys = (ys/np.nanmax(np.abs(ys)))*(self.violin_width/scale) if len(ys) else []
457 ys = [key + (y,) for y in ys]
458
FloatingPointError: underflow encountered in true_divide
HoloViews(Violin)
AutoViML commented
Hi @xingyuezhiji 👍
A simple search on Google for this error shows there are lots of reasons for the error. You could have done the same.
I am posting one of the probable causes - you might want to do your own search.
using the seterr method of numpy to simply ignore this warning (as described in [this old answer](https://stackoverflow.com/a/24769951/9805238)). You can set it as follows at the beginning of your code:
numpy.seterr(under='ignore')
Link: https://stackoverflow.com/questions/61631179/not-able-to-plot-with-large-parameters-value
Next time, please use Google search.
AutoViML