1c758ba9d6c14d9b9d3599e44c3508e2692d8d35,pyprob/distributions/empirical.py,Empirical,expectation,#Empirical#Any#,84

Before Change


        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.
            for i in range(self.length):
                ret += util.to_tensor(func(self.values[i]), dtype=torch.float64) * self.weights[i]

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()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

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: rusty1s/pytorch_geometric
Commit Name: 455a0dc9a98212089a7201a025670c33a1770f67
Time: 2017-10-23
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/functional/spline_gcn_test.py
Class Name: SplineGcnTest
Method Name: test_backward


Project Name: geomstats/geomstats
Commit Name: f73bc9895e5a454eec2311a2e624227e5fb2848f
Time: 2019-06-13
Author: ninamio78@gmail.com
File Name: geomstats/backend/pytorch.py
Class Name:
Method Name: array


Project Name: Netflix/vmaf
Commit Name: 7ce4f2b040155510277f8e8a5fa1879c4e841f15
Time: 2016-02-16
Author: zli@netflix.com
File Name: python/vmaf_quality_runner.py
Class Name: VmafQualityRunner
Method Name: _rescale