Jakub Kowalski - Rising Star
Jakub Kowalski has been making waves in the junior circuit with his aggressive playing style and powerful serves. Known for his resilience on clay courts, he is one to watch in upcoming matches at Bielsko Biala. His recent victory at an ITF Futures event has boosted his confidence as he aims for higher rankings in the ATP Challenger Tour.
<|repo_name|>danielstanley/pymc<|file_sep|>/doc/source/api/stochastic.rst .. currentmodule:: pymc Stochastic Objects ================== .. autosummary:: :toctree: generated/ Stochastic DiscreteRV ContinuousRV StochasticMetaClass .. autoclass:: Stochastic :members: :inherited-members: :show-inheritance: .. autoclass:: DiscreteRV :members: :inherited-members: :show-inheritance: .. autoclass:: ContinuousRV :members: :inherited-members: :show-inheritance: .. autoclass:: StochasticMetaClass <|file_sep|># Copyright (c) PyMC Developers. # Distributed under the terms of the BSD-3-Clause License. """Test stochastics.""" import pytest import numpy as np import pymc as pm from pymc import Model def test_stochastic_values(): """Test setting values.""" class MyStoch(pm.Stochastic): def __init__(self): super().__init__("MyStoch", value=1) def logp(self): return -np.log(2) def random(self): return np.random.choice([0.0]) def pointwise(self): return True def _get_shape(self): return () def _get_dims(self): return () @classmethod def get_test_value(cls): return np.array(0) @classmethod def get_default_transform(cls): return None @classmethod def get_memoized_attr_names(cls): return () @property def name(self): return "MyStoch" @property def dtype(self): return float @property def tag(self): return () @property def ndim_supp(self): return self.shape[0] @property def ndims_params(self): return () @property def dtype_params(self): return () @property def dtype_supp(self): return self.dtype @property def dtype_transformed(self): return self.dtype @property def transform(self): return self.get_default_transform() @property def transformed(self): if self.transform is None: raise ValueError("Transformed stochastic must have a transform.") else: raise NotImplementedError("Transformed stochastic not implemented.") @property def distribution(self): raise NotImplementedError("Distribution not implemented.") @property def observed_value(self): raise NotImplementedError("Observed value not implemented.") @observed_value.setter def observed_value(self, val): raise NotImplementedError("Observed value setter not implemented.") @property def observed_mask(self): raise NotImplementedError("Observed mask not implemented.") @observed_mask.setter def observed_mask(self, val): raise NotImplementedError("Observed mask setter not implemented.") @property def observed_RVs(self): raise NotImplementedError("Observed RVs not implemented.") @observed_RVs.setter def observed_RVs(self, val): raise NotImplementedError("Observed RVs setter not implemented.") model = Model() m = MyStoch() model.add_stochastic(m) assert m.value == m.default_value == m.tagged_values == m.test_value == m.transformed.tagged_values == np.array(1) <|file_sep|># Copyright (c) PyMC Developers. # Distributed under the terms of the BSD-3-Clause License. """Test all distributions.""" import numpy as np import pymc as pm def test_all_distributions(): """Test all distributions.""" for dist_name in pm.distributions.Distribution.__all__: # Test creation. pm.distributions.Distribution.__dict__[dist_name].test() <|file_sep|># Copyright (c) PyMC Developers. # Distributed under the terms of the BSD-3-Clause License. """Test some base classes.""" from collections import OrderedDict import numpy as np import pymc as pm def test_basic_model(): """Test basic model.""" model = pm.Model() assert isinstance(model.stochastics.values(), OrderedDict) <|repo_name|>danielstanley/pymc<|file_sep|>/doc/source/api/distributions.rst .. currentmodule:: pymc.distributions Distributions Module API Reference Guide ======================================== .. autosummary:: :toctree: generated/ DistributionContainerMixin Distributions API Reference Guide ================================= Continuous Distributions API Reference Guide: .. autosummary:: :toctree: generated/ UniformDistribution Discrete Distributions API Reference Guide: .. autosummary:: :toctree: generated/ BernoulliDistribution All Distributions API Reference Guide: .. autosummary:: :toctree: generated/ BetaDistribution BinomialDistribution CauchyDistribution Chi2Distribution DirichletDistribution ExponentialDistribution GammaDistribution HalfCauchyDistribution HalfNormalDistribution InverseGammaDistribution LaplaceDistribution LogNormalDistribution MultinomialDistribution MultivariateNormalDistribution NormalDistribution PoissonDistribution .. autoclass:: DistributionContainerMixin(mix_with=object) :members: <|file_sep|># Copyright (c) PyMC Developers. # Distributed under the terms of the BSD-3-Clause License. """Test conditional distributions.""" from collections import OrderedDict import numpy as np import aesara.tensor as at import pytest import pymc as pm def test_conditioning_on_random_variables(): """Test conditioning on random variables.""" with pm.Model() as model: x = pm.Normal("x", mu=0.0) y = pm.Normal("y", mu=x) assert y.distribution.parent_dict == {"mu": x} <|repo_name|>danielstanley/pymc<|file_sep|>/tests/test_distributions.py # Copyright (c) PyMC Developers. # Distributed under the terms of the BSD-3-Clause License. """Tests for distributions.""" import pytest @pytest.mark.parametrize( "dist", [pm.Beta.dist, pm.Dirichlet.dist, pm.Exponential.dist, pm.Gamma.dist, pm.InverseGamma.dist, pm.Laplace.dist, pm.LogNormal.dist, pm.Multinomial.dist, pm.MultivariateNormal.dist, pm.Normal.dist], ) def test_distribution_param_shapes(dist): """Test distribution param shapes.""" params = dist.test_point() params["shape"] = [5] params["sd"] = [1] * len(params["shape"]) assert dist(**params).shape == params["shape"] <|repo_name|>danielstanley/pymc<|file_sep|>/doc/source/api/variational.rst .. currentmodule:: pymc.variational Variational Inference Module API Reference Guide ================================================= This section describes all functions defined within this module. Functions ---------- .. autosummary:: .. autofunction:: MeanField .. autofunction:: ADVI Variational Inference API Reference Guide ========================================== Mean Field ---------- The MeanField class contains methods for performing mean-field variational inference. The constructor takes two arguments: * **model**: A PyMC model instance. * **approximation**: An instance representing an approximation distribution. The MeanField class has two methods: * **fit(n=50000)**: This method performs variational inference using mean-field approximation. * **sample(draws=1000)**: This method generates samples from an approximation distribution. .. autoclass:: MeanField :members: ADVI ---- The ADVI class contains methods for performing automatic differentiation variational inference. The constructor takes two arguments: * **model**: A PyMC model instance. * **approximation**: An instance representing an approximation distribution. The ADVI class has three methods: * **fit(n=50000)**: This method performs variational inference using ADVI. * **sample(draws=1000)**: This method generates samples from an approximation distribution. * **evaluate_point(point)**: This method evaluates an approximation distribution at given points. .. autoclass:: ADVI :members: <|repo_name|>danielstanley/pymc<|file_sep|>/tests/test_variational.py # Copyright (c) PyMC Developers. # Distributed under the terms of the BSD-3-Clause License. """Tests for variational inference.""" from collections import OrderedDict import numpy as np def test_variational_inference(): """Test variational inference.""" from aesara_theano_fallback.tensor.sharedvar import shared_randomstreams_normal_sample_op_py_op_2float64_int32_0_1_2_bool__context_py_ssp_type_contextmanager import SharedRandomStreams from aesara_theano_fallback.compile.ops import shared_reductions_op_py_ssp_type_contextmanager from aesara_theano_fallback.graph.basic import Apply from aesara_theano_fallback.tensor.subtensor import set_subtensor from aesara_theano_fallback.tensor.type import TensorType from aesara_theano_fallback.gof import Variable from aesara_theano_fallback.compile.sharedvalue import SharedVariable from aesara_theano_fallback.tensor.elemwise import DimShuffle from aesara_theano_fallback.graph.opt import register_canonicalize from aesara_theano_fallback.graph.optdb import OptimizationQuery from aesara_theano_fallback.graph.optdb import OptimizationQuery from aesara_theano_fallback.graph