Help changing time steps from 7 to 30


I have this CNN model that works for predicting 7 days ahead, it’s based on a tutorial with some mix of my own older code for visualizing the data. I now need to make it work for 30 days. How do I do that? What steps do I need to take?

Before I post all the code here, I do have it in a Google Colab and anyone that wishes to help can simply be linked to it. I’ll post the code here on request or I’ll PM the link to anyone that would like me to. I don’t know if posting links in the threads is allowed.

Thanks in advance!

Do you need CNN in your use case?

Have you tried one of the Keras Timeseries colab/tutorial?

1 Like

Well, sounds like you need to restructure the input data’s training windows. So features = n time steps, label = values at 30 days ahead. No idea what your data is but just because a model can predict 7 days ahead does not mean it will preform great at 30 days ahead. Just depends on the nature of the problem.

1 Like


Yes, I need to use CNN for this right now.

It’s worth noting that the time-steps are days, so I only need to include more days.

I’ve not tried the tutorials linked. I’ve been working with this tutorial: Convolutional Neural Networks for Multi-Step Time Series Forecasting

In this case I’ve been instructed to “use the same approach” for 30 days. The model will be adjusted later on if needed.

I’ve not checked it in details but I don’t think that you can predict a 30 days vector without modifying the model as in that specific model the output size is hardwired.

In what means is it hardwired? I’m allowed to modify if needed, I’ve just not yet been able to convince my professor that such is the case. If I can present a modified model that does the job, I think he’ll accept it.

It was related to this claim. You need to adjust your model for a 30 days output (and probably also the input) and train it again.

Agreed if the output is a 30 day vector. I assumed it was a single valued output. For example, the stock trading price of google will be x in 30 days vs the closing price of google will be (y1,y2,…y30). Not sure what @Zarkaylia is looking for.

For single valued design, you should be able to just retrain the model for that one value. If it’s a vector spanning 30 days then you will need to change the final layer’s output to 30 units. For this case, you might want to test trying out a LSTM model too.

At least that is how I am currently understanding the problem. Hopefully it’s helpful.

Would it be better if I link my code?

I do think my question then boils down to “how do I adjust the model for a 30 day vector output?”, I am working with closing values of BitCoin: data. .

Note, the result doesn’t need to be perfect. My end goal is a multithreaded CNN model that handles the 30 days vector output (as seen at the end of the tutorial I linked). But I need the rest to work first. LSTM is only to maybe be done after as possible comparison of results.

Sure, send the link.

OK, I did just now reach some form of “breakthrough”. I got a clue from your replies (many thanks for that!) and figured out that splitting the test set with 30 was impossible cause it was too small. So I changed its size. The code runs now, the output plot is just not right yet.

That said… Feel welcome to check anyways. I’ll PM it.

EDIT: Nope, can’t find how to if I even can PM. See next post instead.

Colab code. (Comments allowed)