2491af9de0dd8d20c4bb8236d9c51cdb33f14060,deepexplain/tensorflow/methods.py,IntegratedGradients,run,#IntegratedGradients#,172
Before Change
self.baseline = baseline
def run(self):
if self.baseline is None: self.baseline = np.zeros((1,)+self.xs.shape[1:])
elif self.baseline.shape == self.xs.shape[1:]:
self.baseline = np.expand_dims(self.baseline, 0)
else:
raise RuntimeError("Baseline shape %s does not match expected shape %s"
% (self.baseline.shape, self.xs.shape[1:]))
attributions = self.get_symbolic_attribution()
gradient = None
for alpha in list(np.linspace(1. / self.steps, 1.0, self.steps)):
xs_mod = self.xs * alpha
After Change
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
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: marcoancona/DeepExplain
Commit Name: 2491af9de0dd8d20c4bb8236d9c51cdb33f14060
Time: 2018-02-23
Author: marco.ancona@inf.ethz.ch
File Name: deepexplain/tensorflow/methods.py
Class Name: IntegratedGradients
Method Name: run
Project Name: kundajelab/dragonn
Commit Name: 9c158b87f5fb2dca1ed95884e667ab2fc218e1b7
Time: 2017-05-01
Author: jisraeli@stanford.edu
File Name: dragonn/models.py
Class Name: SequenceDNN
Method Name: deeplift
Project Name: BYU-PCCL/holodeck
Commit Name: bbe895d707552dcf467aea2f67cca53a738222ed
Time: 2018-01-06
Author: joshua.greaves@gmail.com
File Name: Holodeck/Agents.py
Class Name: DiscreteSphereAgent
Method Name: __act__