model_seq: Model sequence

Description Usage Arguments Value

View source: R/model-seq.R

Description

Analyses or generates a sequence using a PPM model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
model_seq(
  model,
  seq,
  time = NULL,
  zero_indexed = FALSE,
  train = TRUE,
  predict = TRUE,
  return_distribution = TRUE,
  return_entropy = TRUE,
  generate = FALSE
)

Arguments

model

A PPM model object as produced by (for example) new_ppm_simple or new_ppm_decay.

seq

When generate = FALSE an integer vector defining the input sequence (equivalently a numeric vector containing solely integers, or a factor vector, both of which which will be coerced to integer vectors). When generate = TRUE, an integer scalar giving the desired length of the generated sequence.

time

(NULL or a numeric vector) Timepoints corresponding to each element of the sequence. Only used by certain model types (e.g. decay-based models).

zero_indexed

(Logical scalar) Whether or not the seq argument is 0-indexed (i.e. drawn from an alphabet with a minimum value of 0). If FALSE, it is assumed that the sequence is 1-indexed (i.e. drawn from an alphabet with a minimum value of 1).

train

(Logical scalar) Whether or not the model should learn from the incoming sequence.

predict

(Logical scalar) Whether or not to generate predictions for each element of the incoming sequence.

return_distribution

(Logical scalar) Whether or not to return the conditional distribution over each potential continuation as part of the model output (ignored if predict = FALSE).

return_entropy

(Logical scalar) Whether or not to return the entropy of each event prediction (ignored if predict = FALSE).

generate

(Logical scalar) If TRUE, the output will correspond to a newly generated sequence with length as specified by the seq argument, produced by sampling from the model's predictive distribution. The default is FALSE.

Value

A tibble which will be empty if predict = FALSE and otherwise will contain one row for each element in the sequence, with the following columns:


pmcharrison/ppm documentation built on June 4, 2021, 9:45 a.m.