Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bayes.py #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update bayes.py #2

wants to merge 1 commit into from

Conversation

PreacherBaby
Copy link

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.

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.
@rlvaugh
Copy link
Owner

rlvaugh commented Jan 3, 2021

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)?

@PreacherBaby
Copy link
Author

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!

@rlvaugh
Copy link
Owner

rlvaugh commented Jan 4, 2021

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.

@PreacherBaby
Copy link
Author

Your book is really cool! It is hard sometimes. But it's cool1

Thank you, too. Have a nice day!

@rlvaugh
Copy link
Owner

rlvaugh commented Jan 4, 2021

Thanks. If you have any questions you can reach me through Linkedin.com.

@AxZxP
Copy link

AxZxP commented Sep 17, 2021

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.

@rlvaugh
Copy link
Owner

rlvaugh commented Sep 17, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants