relevanceMaps: Obtain relevance maps as a climate4R object

View source: R/relevanceMaps.R

relevanceMapsR Documentation

Obtain relevance maps as a climate4R object

Description

Relevance maps are a representation of the influence of the predictor variables on the downscaling over a particular gridpoint on a certain day. The relevance maps are obtained using prediction difference analysis on a trained deep model (see downscaleTrain.keras).

Usage

relevanceMaps(
  x,
  obj,
  C4R.template,
  model,
  outputCoords,
  parch = c("channel", "variable", "all"),
  k = 0,
  l = 2,
  num_samples = 10,
  loss = NULL
)

Arguments

x

A grid (usually a multigrid) of predictor fields.

obj

The object as returned by prepareData.keras.

C4R.template

A climate4R grid that serves as template for the returned prediction object.

model

A keras sequential or functional model.

outputCoords

A matrix. The coordinates of the predictand(s) gridpoints for whom the prediction difference analysis is desired. Longitudes in the first column and latitudes in the second column.

parch

Possible values are c("all","variable","channel"). Indicates whether we want to marginalize the influence of a certain gridpoint as a whole ("all"), to isolate the influence per variable ("variable", i.e., for example to isolate the influence of the specific humidity at all levels: hus500,hus700,...) or of every channel (i.e., "channel") independently.

k

A numeric value. Defines the domain to marginalize around a particular feature with coordinates (i,j). Therefore the new domain has dimensions (i-k:i+k,j-k:j+k). If k=1, then a region of 3x3 is simultaneously marginalized at every step.

l

A numeric value. Defines the domain ((2l+1)x(2l+1)) used to infer the conditional multivariate gaussian distribution

num_samples

A numeric value. How many times do we sample from the multivariate gaussian distribution?

loss

Default to NULL. Otherwise a string indicating the loss function used to train the model. This is only relevant where we have used the 2 custom loss functions of this library: "gaussianLoss" or "bernouilliGammaLoss"

Details

This function relies on keras, which is a high-level neural networks API capable of running on top of tensorflow, CNTK or theano. There are official keras tutorials regarding how to build deep learning models. We suggest the user, especially the beginners, to consult these tutorials before using the downscaleR.keras package. Moreover, we encourage the reader to consult the prediction difference analysis technique employed which is published in this paper.

Value

A climate 4R object containing the relevance maps as members. The attribute attr(out,"memberCoords") is added to the climate4R output object containing the coordinates in sequential order, such as the relevance map of the first member measures the influence on the first coordinate in attr(out,"memberCoords"). downscaleR.keras Wiki

Author(s)

J. Bano-Medina

See Also

Other downscaling.functions: downscalePredict.keras(), downscaleTrain.keras()


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