1c758ba9d6c14d9b9d3599e44c3508e2692d8d35,pyprob/distributions/empirical.py,Empirical,expectation,#Empirical#Any#,84
Before Change
return util.fast_np_random_choice(self.values, self._weights_numpy_cumsum)
def expectation(self, func):
if self.length == 0:
raise RuntimeError("Empirical distribution instance is empty.")
if self._uniform_weights:
return util.to_tensor(sum(map(func, self.values)) / self.length)
else:
ret = 0.
After Change
ret += util.to_tensor(func(self._shelf[str(i)]), dtype=torch.float64) * self._categorical.probs[i].double()
else:
for i in range(self._length):
ret += util.to_tensor(func(self._values[i]), dtype=torch.float64) * self._categorical.probs[i].double()
return util.to_tensor(ret)
def map(self, func):
self._check_finalized()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: pyprob/pyprob
Commit Name: 1c758ba9d6c14d9b9d3599e44c3508e2692d8d35
Time: 2018-09-28
Author: atilimgunes.baydin@gmail.com
File Name: pyprob/distributions/empirical.py
Class Name: Empirical
Method Name: expectation
Project Name: pyprob/pyprob
Commit Name: 1c758ba9d6c14d9b9d3599e44c3508e2692d8d35
Time: 2018-09-28
Author: atilimgunes.baydin@gmail.com
File Name: pyprob/distributions/empirical.py
Class Name: Empirical
Method Name: effective_sample_size
Project Name: Scitator/catalyst
Commit Name: ce9ef7662cad1788017899cda41dbca3cc396b71
Time: 2019-03-22
Author: grinchuk.alexey@gmail.com
File Name: catalyst/rl/offpolicy/sampler.py
Class Name: Sampler
Method Name: run