-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from pymc.step_methods.arraystep import ArrayStep | ||
|
||
class CannotSampleRV(ArrayStep): | ||
""" | ||
A step method that raises an error when sampling a latent Multinomial variable. | ||
""" | ||
name = "cannot_sample_rv" | ||
def __init__(self, vars, **kwargs): | ||
# Remove keys that ArrayStep.__init__ does not accept. | ||
kwargs.pop("model", None) | ||
kwargs.pop("initial_point", None) | ||
kwargs.pop("compile_kwargs", None) | ||
self.vars = vars | ||
super().__init__(vars=vars,fs=[], **kwargs) | ||
|
||
def astep(self, q0): | ||
# This method is required by the abstract base class. | ||
raise ValueError( | ||
"Latent Multinomial variables are not supported" | ||
) | ||
|