Skip to content

Renamed SMC files #6174

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

Merged
merged 1 commit into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/api/smc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Sequential Monte Carlo
SMC kernels
-----------

.. currentmodule:: pymc.smc.smc
.. currentmodule:: pymc.smc.kernels
.. autosummary::
:toctree: generated/

Expand Down
5 changes: 4 additions & 1 deletion pymc/smc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from pymc.smc.sample_smc import sample_smc
from pymc.smc.kernels import IMH, MH
from pymc.smc.sampling import sample_smc

__all__ = ("sample_smc",)
Copy link
Member

Choose a reason for hiding this comment

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

@IMvision12 you didn't include IMH and MH in __all__?

Copy link
Member

Choose a reason for hiding this comment

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

They weren't available at the root level before, just via pymc.smc. I think it was fine like that

Copy link
Member

Choose a reason for hiding this comment

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

nit: Isn't __all__ usually a list? In PyMC it is a list in 42 places and a tuple in only 2.

Copy link
Member

Choose a reason for hiding this comment

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

I'm team tuples

File renamed without changes.
2 changes: 1 addition & 1 deletion pymc/smc/sample_smc.py → pymc/smc/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from pymc.backends.base import MultiTrace
from pymc.model import modelcontext
from pymc.parallel_sampling import _cpu_count
from pymc.smc.smc import IMH
from pymc.smc.kernels import IMH


def sample_smc(
Expand Down
2 changes: 1 addition & 1 deletion pymc/tests/distributions/test_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from pymc import floatX
from pymc.aesaraf import compile_pymc
from pymc.initial_point import make_initial_point_fn
from pymc.smc.smc import IMH
from pymc.smc.kernels import IMH
from pymc.tests.helpers import SeededTest


Expand Down
6 changes: 3 additions & 3 deletions pymc/tests/smc/test_smc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from pymc.aesaraf import floatX
from pymc.backends.base import MultiTrace
from pymc.smc.smc import IMH
from pymc.smc.kernels import IMH, systematic_resampling
from pymc.tests.helpers import SeededTest, assert_random_state_equal


Expand Down Expand Up @@ -291,6 +291,6 @@ def test_proposal_dist_shape(self):
def test_systematic():
rng = np.random.default_rng(seed=34)
weights = [0.33, 0.33, 0.33]
np.testing.assert_array_equal(pm.smc.systematic_resampling(weights, rng), [0, 1, 2])
np.testing.assert_array_equal(systematic_resampling(weights, rng), [0, 1, 2])
weights = [0.99, 0.01]
np.testing.assert_array_equal(pm.smc.systematic_resampling(weights, rng), [0, 0])
np.testing.assert_array_equal(systematic_resampling(weights, rng), [0, 0])
4 changes: 2 additions & 2 deletions scripts/run_mypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
pymc/plots/__init__.py
pymc/sampling.py
pymc/smc/__init__.py
pymc/smc/sample_smc.py
pymc/smc/smc.py
pymc/smc/sampling.py
pymc/smc/kernels.py
pymc/stats/__init__.py
pymc/step_methods/__init__.py
pymc/step_methods/compound.py
Expand Down