Skip to content

fix bugs in brainpy.math.random.truncated_normal#574

Merged
chaoming0625 merged 8 commits intomasterfrom
fix-random
Jan 2, 2024
Merged

fix bugs in brainpy.math.random.truncated_normal#574
chaoming0625 merged 8 commits intomasterfrom
fix-random

Conversation

@chaoming0625
Copy link
Copy Markdown
Member

  • fix bugs in brainpy.math.random.truncated_normal
  • copy random doc of numpy for better readability

Copy link
Copy Markdown
Collaborator

@charlielam0615 charlielam0615 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments and happy new year!

@chaoming0625
Copy link
Copy Markdown
Member Author

Have changed the algorithm of truncated _normal sampling using methods from

@chaoming0625
Copy link
Copy Markdown
Member Author

The truncated_normal is not straightforward to multiply the scale and shift the loc. I have checked the algorithms and confirmed the results using methods in https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf

@chaoming0625
Copy link
Copy Markdown
Member Author

One more thing, I have add the checking for the valid setting of loc, scale, upper, and lower, in order to avoid the incorrent sampling.

@chaoming0625 chaoming0625 merged commit 256cb27 into master Jan 2, 2024
@chaoming0625 chaoming0625 deleted the fix-random branch January 2, 2024 02:40
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.

2 participants