8d7f748e1d8eae7d57444c6e42119dadc47287e9,deepexplain/tensorflow/methods.py,IntegratedGradients,run,#IntegratedGradients#,207

Before Change


        attributions = self.get_symbolic_attribution()
        gradient = None
        for alpha in list(np.linspace(1. / self.steps, 1.0, self.steps)):
            xs_mod = (np.array(self.xs) * alpha).tolist()
            _attr = self.session_run(attributions, xs_mod)
            if gradient is None: gradient = np.array(_attr)
            else: gradient += np.array(_attr)
        results = gradient * (np.array(self.xs) - np.array(self.baseline)) / self.steps
        return results[0] if not self.has_multiple_inputs else results

After Change


        attributions = self.get_symbolic_attribution()
        gradient = None
        for alpha in list(np.linspace(1. / self.steps, 1.0, self.steps)):
            xs_mod = [xs * alpha for xs in self.xs] if self.has_multiple_inputs else self.xs * alpha
            _attr = self.session_run(attributions, xs_mod)
            if gradient is None: gradient = _attr
            else: gradient = [g + a for g, a in zip(gradient, _attr)]

        results = [g * (x - b) / self.steps for g, x, b in zip(
            gradient,
            self.xs if self.has_multiple_inputs else [self.xs],
            self.baseline if self.has_multiple_inputs else [self.baseline])]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: marcoancona/DeepExplain
Commit Name: 8d7f748e1d8eae7d57444c6e42119dadc47287e9
Time: 2018-02-27
Author: marco.ancona@inf.ethz.ch
File Name: deepexplain/tensorflow/methods.py
Class Name: IntegratedGradients
Method Name: run


Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: 722531f6e47ead8b5a5d2e4427f5bfef319e483b
Time: 2019-03-22
Author: jan@motl.us
File Name: category_encoders/basen.py
Class Name: BaseNEncoder
Method Name: basen_to_integer


Project Name: OpenNMT/OpenNMT-tf
Commit Name: ea2a0bfb9f60f7e03a3ed25244622e0d90b275a5
Time: 2019-03-27
Author: guillaume.klein@systrangroup.com
File Name: opennmt/inputters/record_inputter.py
Class Name:
Method Name: write_sequence_record