|
| 1 | +# Copyright 2025 - present The PyMC Developers |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
1 | 14 | from pymc.step_methods.arraystep import ArrayStep |
2 | 15 |
|
| 16 | + |
3 | 17 | class CannotSampleRV(ArrayStep): |
4 | 18 | """ |
5 | 19 | A step method that raises an error when sampling a latent Multinomial variable. |
6 | 20 | """ |
| 21 | + |
7 | 22 | name = "cannot_sample_rv" |
| 23 | + |
8 | 24 | def __init__(self, vars, **kwargs): |
9 | 25 | # Remove keys that ArrayStep.__init__ does not accept. |
10 | 26 | kwargs.pop("model", None) |
11 | 27 | kwargs.pop("initial_point", None) |
12 | 28 | kwargs.pop("compile_kwargs", None) |
13 | 29 | self.vars = vars |
14 | | - super().__init__(vars=vars,fs=[], **kwargs) |
| 30 | + super().__init__(vars=vars, fs=[], **kwargs) |
15 | 31 |
|
16 | 32 | def astep(self, q0): |
17 | 33 | # This method is required by the abstract base class. |
18 | | - raise ValueError( |
19 | | - "Latent Multinomial variables are not supported" |
20 | | - ) |
21 | | - |
| 34 | + raise ValueError("Latent Multinomial variables are not supported") |
0 commit comments