1
$\begingroup$

I have a dataset of songs based on genres. For example, a song may hold {5, 2, 3} as scores set for Sentimental, Rock and Jazz. In total there are 800 songs sequentially arranged. I want to predict the next possible scores of the 801st song. I googled and got that RNNs and LSTMs are pretty good in predicting in terms of time. But all those examples are based on single values like (10,20,30,40,50) and the next predicted value will be 60. But in my problem, each item has three real values. So how to write code I do not understand. Any help or link to an article/paper is appreciated.

$\endgroup$
1
$\begingroup$

Typically a dense layer follows the LSTM/RNN layer(s), because the output of the RNN cell is of dimension of your choice, i.e. latent space dimension. Since you've three outputs, the final Dense layer will have three neurons, aiming to regress genre points. The RNN layer's duty is to figure out a compressed, latent representation of your series going back a couple of time steps of your choice. Here is a good (I believe) introductory tutorial for multivariate time series forecasting. Keras itself has a short example on multi-input/multi-output models. One trick that can be useful for the last Dense layer is that if you have bounded outputs (e.g. $[0,5]$), scaling the output variable and regressing via sigmoid activation may help, instead of linear activation that can cause overflow issues on some inputs.

$\endgroup$
  • $\begingroup$ Thanks. One more question please, what is the difference between Batch size and Sequence size in LSTM/RNN? What I found here is that Batch size is the number of sampling units fed to the network at a time. Then what will be the Sequence size? $\endgroup$ – PS Nayak May 20 '19 at 14:54
  • $\begingroup$ sequence size is number of time steps that a sample has, batch size is number of samples between gradient updates. $\endgroup$ – gunes May 20 '19 at 17:09
  • $\begingroup$ If my Batch size is 5, then it will have 5 songs in each batch. If the Sequence size is 3, then it will have 3 batches i.e., 15 songs in total. Am I correct? $\endgroup$ – PS Nayak May 20 '19 at 17:17
  • $\begingroup$ A sample will contain a few past entries together with the target, e.g. $x_{n-1}...,x_{n-20}$ can be features, and $x_n$ is the target. Sequence size here is 20. Batch will contain a few samples of your choice. If your batch size is 5, you'll have 5 samples, and in each sample you'll have 5 targets, each having 20 past values. $\endgroup$ – gunes May 20 '19 at 20:18
  • $\begingroup$ That means there is a batch of 5 sequences. Within it, each sequence is having 20 items where the last item is the target. Right? $\endgroup$ – PS Nayak May 21 '19 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.