Open PreacherBaby opened 3 years ago
Thank you. I'm not sure why this is happening as I can't reproduce it in the original setup. What happens if you use sailor_x[0] rather than sailor_x.item(0)?
Good morning/afternoon/evening, Excuse me for the late reply.
I've just checked sailor_x[0] - it works fine as item(0) variant in this case!
Great! I need the shortest syntax possible so we don't get a line wrap in the book when it's updated in the next printing. Thanks a lot.
Your book is really cool! It is hard sometimes. But it's cool1
Thank you, too. Have a nice day!
Thanks. If you have any questions you can reach me through Linkedin.com.
If anyone reads this and wonder what happens :
rng.choice(array, size=None)
returns a single value if the array is flat and a single array of n dimension if the array has n dimensions (with n > 1). But
rng.choice(array, size=1)
returns an array even if the shape of the array is 1.
So the best option with rng.choice()
is in my opinion to always leave size=None
(which is the default value) whenever we want to pick only one value. For this exemple, it would simplify the awkward indexing in the following circle fonction.
Please see the recent update to the bayes.py code (lines 90, 91, and 234). This will hopefully clear up the problems some users have with drawing the circle.
LINE #234 - fixed "TypeError: only integer scalar arrays can be converted to a scalar index" in line #234 which caused the program to crash and preventing it from drawing the circle when the sailor coordinates are retrieved.