Learn R Programming

ProcData (version 0.2.5)

seq_gen3: RNN action sequence generator

Description

seq_gen3 generates action sequences according to a recurrent neural network

Usage

seq_gen3(n, events = letters, rnn_type = "lstm", K = 10,
  weights = NULL, max_len = 100, initial_state = NULL,
  start_index = 1, end_index = length(events), include_time = FALSE,
  time_intv_dist = list("exp", 1), gpu = FALSE, parallel = FALSE,
  seed = 12345)

Arguments

n

An integer. The number of action sequences to be generated.

events

A character vector specifying the set of N possible actions. Default is letters.

rnn_type

the type of recurrent unit to be used for generating sequences. "lstm" for the long-short term memory unit. "gru" for the gated recurrent unit.

K

the latent dimension of the recurrent unit.

weights

a list containing the weights in the embedding layer, the recurrent unit, the fully connected layer. If not (properly) specified, randomly generated weights are used.

max_len

Maximum length of generated sequences.

initial_state

a list containing the initial state of the recurrent neural network. If rnn_type="lstm", it contains two 1 by K matrices. If rnn_type="gru", it contains one 1 by K matrix. If not specified, all the elements are set to zero.

start_index

Index of the action indicating the start of an item in events.

end_index

Index of the action indicating the end of an item in events.

include_time

logical. Indicate if timestamp sequences should be generated. Default is FALSE.

time_intv_dist

A list specifying the distribution of the inter-arrival time.

gpu

logical. If TRUE, use gpu for training when available. Default is FALSE.

parallel

logical. If TRUE, allow cpu parallel computing. Default is FALSE.

seed

random generator seed.

Value

A list containing the following elements

seqs

an object of class "proc" with time_seqs=NULL.

weights

a list containing the weights used for generating sequences.

See Also

Other sequence generators: seq_gen2, seq_gen