# KDE failed at 0 : How to debug - Example

**URL:** <https://discourse.pymc.io/t/kde-failed-at-0-how-to-debug-example/682>\
**Category:** Questions\
**Created:** [December 25, 2017, 9:39am UTC](https://discourse.pymc.io/t/kde-failed-at-0-how-to-debug-example/682 "2017-12-25T09:39:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![melodramaqueen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/melodramaqueen/32/427_2.png) [@melodramaqueen](https://discourse.pymc.io/u/melodramaqueen)\
**Post date:** [December 25, 2017, 9:39am UTC](https://discourse.pymc.io/t/kde-failed-at-0-how-to-debug-example/682/1 "2017-12-25T09:39:10Z")

</div>

I updated pymc3 using master. The previous examples worked fine with that. I ran the ‘How to debug a model’

[http://docs.pymc.io/notebooks/howto\_debugging.html](http://docs.pymc.io/notebooks/howto_debugging.html).

When I put

sd = pm.Normal(‘sd’, mu=0, sd=1)

The plots fail saying: KDE failed at 0. If I change the value of mu to any non zero it works fine.

Further, the last plot after the last input is totally blank as against to the expected line graph.

My implementation -

> <https://github.com/melodramaqueen/pymc3-stuff/blob/master/How%20to%20debug%20a%20model.ipynb>

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [December 27, 2017, 6:02pm UTC](https://discourse.pymc.io/t/kde-failed-at-0-how-to-debug-example/682/2 "2017-12-27T18:02:00Z")

</div>

> [@melodramaqueen](#):
>
> The plots fail saying: KDE failed at 0

Not sure if I understand what you mean, but this is kind of the point of this example notebook that all the proposal value is rejected, and you ends up with a trace containing only the initial value (0 in this case). KDE plot fail as there are only one unique value.

---

<div class="post-metadata">

**Author:** ![melodramaqueen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/melodramaqueen/32/427_2.png) [@melodramaqueen](https://discourse.pymc.io/u/melodramaqueen)\
**Post date:** [December 28, 2017, 3:15am UTC](https://discourse.pymc.io/t/kde-failed-at-0-how-to-debug-example/682/3 "2017-12-28T03:15:58Z")

</div>

Okay, yeah right. Thanks. I’m sorry. I Didn’t read properly.

And in the last example. There is no plot in that as against to the line graph that is expected.

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [December 28, 2017, 6:02am UTC](https://discourse.pymc.io/t/kde-failed-at-0-how-to-debug-example/682/4 "2017-12-28T06:02:58Z")

</div>

You are right. The StringIO is not working properly and the notebook needs to be updated as well. PR welcome 😉

---

<div class="post-metadata">

**Author:** ![melodramaqueen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/melodramaqueen/32/427_2.png) [@melodramaqueen](https://discourse.pymc.io/u/melodramaqueen)\
**Post date:** [December 29, 2017, 1:17pm UTC](https://discourse.pymc.io/t/kde-failed-at-0-how-to-debug-example/682/6 "2017-12-29T13:17:02Z")

</div>

I’d like to know though what was supposed to be the graph’s content i.e. the y-axis? It has values ranging from -5 to +3.

My idea is that if we change this line of code right here  
mulines = [s for s in output if ‘mu’ in s]

we can get a better graph.

PS: I am not able to post any images, code etc with my posts. I can’t understand why.

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [December 29, 2017, 2:08pm UTC](https://discourse.pymc.io/t/kde-failed-at-0-how-to-debug-example/682/7 "2017-12-29T14:08:53Z")

</div>

y-axis representing the value of `mu`. I think here the values are the original value, the proposed value and the accepted value (printed 3 values per iteration). But I dont think changing the `mulines` would help, I am not too familiar with I/O but seems the output is not recorded properly.
