get_integrated_gradients: Computes the integrated gradients of the neural network.

View source: R/integratedGradients.R

get_integrated_gradientsR Documentation

Computes the integrated gradients of the neural network.

Description

Given a neural network, computes the integrated gradients for a particular predictand (or output neuron of the model) w.r.t an input predictand field.

Usage

get_integrated_gradients(input, model, baseline = NULL, num_steps = 50, site)

Arguments

input

The input climate4R object or predictor field.

model

A keras sequential or functional model.

baseline

The integrated gradients method attributes the prediction at input 'x' relative to a 'baseline', computing the contribution of 'x' to the prediction. The baseline parameter defines this baseline, . Default to NULL which set the baseline to a 0 array. For custom baselines, input an array with the dimensions matching those of the input layer of the neural network.

num_steps

Number of interpolation steps between the baseline and the input used in the computation of integrated gradients. These steps along determine the integral approximation error. By default, num_steps is set to 50. The authors suggest an interval from 20 to 300.

site

A data frame containing the 'x' and 'y' coordinates of the desired site where to compute the gradients. e.g., site = data.frame("x" = -3.82, "y" = 43.46)

Value

A matrix/array of the integrated gradients of the predictions w.r.t input

Author(s)

J. Bano-Medina


SantanderMetGroup/downscaleR.keras documentation built on July 7, 2023, 1:22 p.m.