How to construct a Computation Graph with input from 2 time series of different sampling periods?

How to construct a Computation Graph with input from 2 time series of different sampling periods? For example, one is sampled daily and one is sampled weekly?
Please give an example, thanks!

@cqiaoYc could you tell me what you tried so far? I think I mentioned the starting point in the github issue.

Thanks for your reply in github issue.
I don’t know how to combine two separate sequence iterators with different sampling periods.
I want to build a ComputationGraph such as :

@cqiaoYc you’d need to use a merge vertex:

Thank your ! Let me try.

My requirement is to execute 7timesteps of daily time series for each timestep of weekly time series and. The method in the above example can be inferred by executing single timestep of weekly time series. But how to train computational graphs?

@cqiaoYc could you clarify? I"m not sure what you want to do. If you are talking about how to setup the data, just do it separately as if you would a single path neural network using the CSVSequenceRecordReader.

Combine each separate iterator in to a RecordReaderMultiDataSetIterator.

Let me know if you need more than that. We have examples for that.

@agibsonccc Instead of merging the last time step of the daily sampled time series, I want to merge the time steps of each Sunday of the daily time series into the weekly sample time series.
For example, I want to predict the average temperature for the next week, and the features included in each time step are: the average weekly temperature, the average temperature of each day from Monday to Sunday in the week. Now organize the weekly average temperature into a weekly sampling time series, and the daily average temperature into a daily sampling time series.

The daily sampled time series looks like a 4-dimensional array.

@cqiaoYc I understand that. My advice is still the same. Create 2 iterators, create a multi datasetiterator, feed that to your network.

@agibsonccc Now, my question is how to control merged daily timesteps are d(7*i)s, not the last one of the whole daily timeseries? Can you give me an example include a computational graph structure and iterators? This should be a generic requirement.

@cqiaoYc break it down at the individual level, understand what your biggest possible array is from the merged time steps and build the appropriate mask arrays.

@agibsonccc The daily sampling time series length is 7 times the weekly sample time series length, and all Sunday’s time steps in the daily time series need to be extracted to align weekly timeseries before merging. If masked arrays are used, how to align them?

@cqiaoYc do me a favor…build 2 separate LSTMs first and make those work then build the concat architecture. If you’re not familiar with how masks work I think stepping through and doing a simpler example first would be easier: Recurrent Neural Network - Deeplearning4j

I already mentioned you need to figure out the size of what the concatneated array would look like. I’m not doing any math for you. I’ll give you pointers though.

@agibsonccc I know masks. But I think what I need is a preprocessor and not masks. I need extract all Sunday’s time steps in daily time series, to get a weekly time series using preprocessor.
Thank you very much!

@cqiaoYc that doesn’t really have much to do with deep learning unfortunately. The best thing I can say here is build a pipeline using your favorite framework.

We have some support for this in datavec (please check out the transform process separately this is just showing the record reader):

Build 2 separate iterators based on the transform process and combine those in to a multi datasetiterator.

Transform process example here: deeplearning4j-examples/ at 051c59bd06b38ed39ca92f5940a6ca43b0f34c0f · deeplearning4j/deeplearning4j-examples · GitHub

You could also give tablesaw a shot: GitHub - jtablesaw/tablesaw: Java dataframe and visualization library

@agibsonccc Thank you for the resources, they look useful. I think I can solve my problem. Thanks again!

@agibsonccc Thank you very much for your help. I followed your guidance and wrote a MultiTimeSeriesDataSetIterator class, and customized a Vertex class to extract and extend daily time series based on the ReverseTimeSeriesVertex class. Then I put the custom Vertex in front of the mergeVertex and built a computational graph. It can work well. Thanks again!

1 Like