9e010808de2555cd673ceb9d472751c70adaf7c6,elfi/distributions.py,RandomVariable,_prepare_operation,#RandomVariable#Any#Any#,118

Before Change


    def _prepare_operation(self, distribution, size=(1,), **kwargs):
        if isinstance(distribution, (str, ss.rv_discrete, ss.rv_continuous)):
            distribution = ScipyDistribution(distribution, size)
        elif isinstance(distribution, type) and issubclass(distribution, Distribution):
            try:
                distribution = distribution(size)
            except:

After Change


        if not hasattr(distribution, "rvs"):
            raise ValueError("Distribution {} must implement rvs method".format(distribution))

        if not isinstance(size, tuple):
            size = (size,)

        self.distribution = distribution
        return partial(rvs_operation, distribution=distribution, size=size)

    def __str__(self):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: elfi-dev/elfi
Commit Name: 9e010808de2555cd673ceb9d472751c70adaf7c6
Time: 2016-12-07
Author: jarno.lintusaari@aalto.fi
File Name: elfi/distributions.py
Class Name: RandomVariable
Method Name: _prepare_operation


Project Name: markovmodel/PyEMMA
Commit Name: a68a41b9182a6b9f112f659e893800631c13eb39
Time: 2017-12-17
Author: m.scherer@fu-berlin.de
File Name: pyemma/_base/serialization/serialization.py
Class Name: SerializableMixIn
Method Name: __getstate__


Project Name: pantsbuild/pants
Commit Name: dfc3f5b456b0a0395ac8cb3b64a3917a2be05c41
Time: 2020-07-10
Author: benjyw@gmail.com
File Name: src/python/pants/help/help_info_extracter.py
Class Name: HelpInfoExtracter
Method Name: compute_default


Project Name: pytorch/text
Commit Name: 889b03c66f434b4ea2a281b847751afc760b2c8b
Time: 2018-03-17
Author: martin.tutek@gmail.com
File Name: torchtext/data/batch.py
Class Name:
Method Name: _short_str