Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
area_perc_th=extra_parameters.area_threshold,
min_pixel_diff=extra_parameters.experimental_params['min_pixel_diff'],
gain_fun=_gain_density,
integer_segments=extra_parameters.flatten_xrai_segments)
elif extra_parameters.algorithm == 'fast':
attr_map, attr_data = self._xrai_fast(
attr=attr,
segs=segs,
min_pixel_diff=extra_parameters.experimental_params['min_pixel_diff'],
gain_fun=_gain_density,
integer_segments=extra_parameters.flatten_xrai_segments)
else:
raise ValueError('Unknown algorithm type: {}'.format(
extra_parameters.algorithm))
results = XRAIOutput(attr_map)
results.baselines = x_baselines
if extra_parameters.return_xrai_segments:
results.segments = attr_data
# TODO(tolgab) Enable return_baseline_predictions
# if extra_parameters.return_baseline_predictions:
# baseline_predictions = []
# for baseline in x_baselines:
# baseline_predictions.append(self._predict(baseline))
# results.baseline_predictions = baseline_predictions
if extra_parameters.return_ig_attributions:
results.ig_attribution = attrs
return results