ThinkBayes2 icon indicating copy to clipboard operation
ThinkBayes2 copied to clipboard

TypeError: '<' not supported between instances of 'Pmf' and 'Pmf'

Open manujchandra opened this issue 6 years ago • 1 comments

When running redline.py's RunMixProcess() the following error is shown:

CI z (3.1, 12.483333333333333) Writing redline0.pdf Mean z 7.775313741407206 Mean zb 8.896772000693552 Mean y 4.448386000346783 Writing redline2.pdf Writing redline3.pdf 20 0.8964230763420535 2 14 3.9218230371662175 7 20 2.918634295466948 9 25 1.0969132651473539 2 2 2.9606902100440924 5 25 11.794483884166665 Average arrival rate 2.119634928117617 Mean posterior lambda 0.03674032163607093 Writing redline1.pdf


TypeError Traceback (most recent call last) in ----> 1 RunMixProcess(OBSERVED_GAP_TIMES)

in RunMixProcess(gap_times, lam, num_passengers, plot) 34 35 if plot: ---> 36 wme.MakePlot() 37 38 return wme

in MakePlot(self, root) 27 28 # plot the MetaPmf ---> 29 for pmf, prob in sorted(self.metapmf.Items()): 30 cdf = pmf.MakeCdf().Scale(1.0/60) 31 width = 2/math.log(-math.log(prob))

TypeError: '<' not supported between instances of 'Pmf' and 'Pmf'

Using Python version 3.7.3 Anaconda Version :

"fn": "anaconda-2019.03-py37_0.tar.bz2", "installed_by": "Anaconda3-2019.03-Windows-x86_64.exe"

OS Windows 10

Thanks.

manujchandra avatar Apr 18 '19 05:04 manujchandra

Hi, if it helps, I was able to make the error go away and get Fig 8.5 to render is by changing

for pmf, prob in sorted(self.metapmf.Items()):

to

for pmf, prob in self.metapmf.Items():

The figure seems to get rendered alright. But I am unsure if removing sorted() is impacting the result of the analysis.

manujchandra avatar Apr 18 '19 06:04 manujchandra