Skip to contents

Reads h5 file created by predict_model function.

Usage

load_prediction(
  h5_path,
  rows = NULL,
  verbose = FALSE,
  get_sample_position = FALSE,
  get_seq = FALSE
)

Arguments

h5_path

Path to h5 file.

rows

Range of rows to read. If NULL read everything.

verbose

Boolean.

get_sample_position

Return position of sample corresponding to state if TRUE.

get_seq

Return nucleotide sequence if TRUE.

Value

A list of data frames, containing model predictions and sequence positions.

Examples

if (FALSE) { # reticulate::py_module_available("tensorflow")
# make prediction for single sequence and write to h5 file
model <- create_model_lstm_cnn(maxlen = 20, layer_lstm = 8, layer_dense = 2, verbose = FALSE)
vocabulary <- c("a", "c", "g", "t")
sequence <- paste(sample(vocabulary, 200, replace = TRUE), collapse = "")
output_file <- tempfile(fileext = ".h5")
predict_model(output_format = "one_seq", model = model, step = 10,
              sequence = sequence, filename = output_file, mode = "label")
load_prediction(h5_path = output_file)
}