-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Context:** ``` probs = np.array([1e-6 for _ in range(300)]) results = [math.Categorical(probs, "") for _ in range(100)] assert len(set(results)) > 1 ``` When using the numpy backend, the code above fails: `results` contains 100 identical values. This is because `math.Categorical` uses `np.random.multinomial`, which assumes that the probabilities sum up to `1` (if not, the last probability is increased such that the resulting probabilities sum up to `1`)
- Loading branch information
SamFerracin
authored
Feb 8, 2024
1 parent
db1f4d5
commit ab1f82d
Showing
4 changed files
with
15 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters