e3fd56b08ed5c4d7247a147c3fab7c0fe59e9a0e,pymc3/distributions/mixture.py,Mixture,comp_dists,#Mixture#Any#,111
Before Change
with _DrawValuesContextBlocker():
if isinstance(self.comp_dists, (list, tuple)):
try:
[comp_dist.random(size=23)
for comp_dist in self.comp_dists]
self._comp_dists_vect = True
except Exception:
// The comp_dists cannot call random with non None size or
After Change
@comp_dists.setter
def comp_dists(self, comp_dists):
self._comp_dists = comp_dists
if isinstance(comp_dists, Distribution):
self._comp_dist_shapes = to_tuple(comp_dists.shape)
self._broadcast_shape = self._comp_dist_shapes
self.comp_is_distribution = True
else:
// Now we check the comp_dists distribution shape, see what
// the broadcast shape would be. This shape will be the dist_shape
// used by generate samples (the shape of a single random sample)
// from the mixture
self._comp_dist_shapes = [to_tuple(d.shape) for d in comp_dists]
// All component distributions must broadcast with each other
try:
self._broadcast_shape = np.broadcast(
*[np.empty(shape) for shape in self._comp_dist_shapes]
).shape
except Exception:
raise TypeError("Supplied comp_dists shapes do not broadcast "
"with each other. comp_dists shapes are: "
"{}".format(self._comp_dist_shapes))
// We wrap the _comp_dist.random by adding the kwarg raw_size_,
// which will be the size attribute passed to _comp_samples.
// _comp_samples then calls generate_samples, which may change the
// size value to make it compatible with scipy.stats.*.rvs
self._generators = []
for comp_dist in comp_dists:
generator = Mixture._comp_dist_random_wrapper(comp_dist.random)
self._generators.append(generator)
self.comp_is_distribution = False
@staticmethod
def _comp_dist_random_wrapper(random):
Wrap the comp_dists.random method to take the kwarg raw_size_ and
use it"s value to replace the size parameter. This is needed because
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances Project Name: pymc-devs/pymc3
Commit Name: e3fd56b08ed5c4d7247a147c3fab7c0fe59e9a0e
Time: 2019-02-16
Author: luciano.paz.neuro@gmail.com
File Name: pymc3/distributions/mixture.py
Class Name: Mixture
Method Name: comp_dists
Project Name: pymc-devs/pymc3
Commit Name: 7cd66b7ff35659bf6dc7ae100794925e18708781
Time: 2017-12-12
Author: aloctavodia@gmail.com
File Name: pymc3/step_methods/smc.py
Class Name: SMC
Method Name: __init__
Project Name: Rostlab/nalaf
Commit Name: c3b8333a251c62315b52c599033ef97c697a31a4
Time: 2016-12-30
Author: i@juanmi.rocks
File Name: nalaf/utils/floyd_warshall.py
Class Name:
Method Name: path