Skip to content

Sampling from RNN #304

Open
Open
@yashmaverick

Description

@yashmaverick

@nicholas-leonard
I am trying to predict the next number in a sequence, where each sequence is of length say 5.

For example: input is {1,2,3,4,5}
target is {2,3,4,5,6}

Training set has 1000 such sequences
Validation set has 100 sequences

Model is as shown below:
SeqLen = 5
rho = 5 -- no .of steps BPTT
batchSize = 1
hiddenSize = 20
inputSize = 1
outputSize = 1
no_sampling = 10

model = nn.Sequential()
:add(nn.Sequencer(nn.FastLSTM(inputSize,hiddenSize)))
:add(nn.Sequencer(nn.Linear(hiddenSize, outputSize)))
:add(nn.Sequencer(nn.ReLU()))

While inference, how to do sampling from the model ??

I wish to sample from the model 10 times (say 10 trials).

While sampling at first time,
inputs are {t1,t2,t3,t4,t5} and true output is say {t2,t3,t4,t5,t6} and
if the model predicts {t2',t3',t4',t5',t6'}

Next time when I sample, what will be my inputs?

Case1: inputs {t2,t3,t4,t5,t6'} or

Case2: {t2',t3',t4',t5',t6'}

Case3: only {t6'}, if I go on sampling indefinitely like this, is there a chance that predictions after rho trail here (5th trial) are same ??

But in either of Case1 and Case2, to sample for 5th time, my inputs will be completely
predictions i.e {t6',t7',t8',t9',t10'}. The issue is only with sampling for first four trials during sampling.

Also, will it be good if I treat this problem as 'Sequence to One' prediction, where during training the inputs are {1,2,3,4,5} and target is {6} ??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions