heatmaps_integrated_grad: Heatmap of integrated gradient scores

View source: R/visualization.R

heatmaps_integrated_gradR Documentation

Heatmap of integrated gradient scores

Description

Creates a heatmap from output of integrated_gradients function. The first row contains the column-wise absolute sums of IG scores and the second row the sums. Rows 3 to 6 contain the IG scores for each position and each nucleotide. The last row contains nucleotide information.

Usage

heatmaps_integrated_grad(integrated_grads, input_seq)

Arguments

integrated_grads

Matrix of integrated gradient scores (output of integrated_gradients function).

input_seq

Input sequence for model. Should be the same as input_seq input for corresponding integrated_gradients call that computed input for integrated_grads argument.

Value

A list of heatmaps.

Examples


library(reticulate)
model <- create_model_lstm_cnn(layer_lstm = 8, layer_dense = 3, maxlen = 20, verbose = FALSE)
random_seq <- sample(0:3, 20, replace = TRUE)
input_seq <- array(keras::to_categorical(random_seq), dim = c(1, 20, 4))
ig <- integrated_gradients(
  input_seq = input_seq,
  target_class_idx = 3,
  model = model)
heatmaps_integrated_grad(integrated_grads = ig,
                         input_seq = input_seq)
 


GenomeNet/deepG documentation built on Dec. 24, 2024, 12:11 p.m.