I am trying to build a deep learning neural model using keras and tensorflow which can predict if a certain event will occur based on a set of timeseries data and some fixed data together . For example: For a given set of entities say , Their price behavior is co-related due to rumor of some event that is going to happen in future.

1) A & B 's fixed data like type, group etc.
2) During a certain period of time - 1 Jan 2015 - 30 Mar 2015 , their price .

Data that I have is

INPUT : Name of entity, Type Of entity , Size , Country, Specific Attributes  and time series stock data from 1 Jan 2015 - 30 Mar 2015 
OUTPUT : Y/N . Boolean output if event happend or not. 

Now my question is how do I build this since I have some fixed data which doesn't changes over time and some time series data which changes over time.

Options that I thought of are 1) LSTM - But not sure if I should feed in fixed static data. 2) CNN - Not sure if it is the right approach ?

Please let me know what should be my approach to handle such a problem.


1 Answer 1


Since you have features that would be handled best with a recurrent neural net, AND some features that would be handled best with a feedforward net, what you can actually do is both and feed them into a main Dense layer which has a softmax output to give you the probability distribution.

This would be rather hard to do by hand, but luckily you are using Keras, which allows for this kind of modeling rather easily!

In the Keras functional API guide https://keras.io/getting-started/functional-api-guide/, there is a model actually very similar to what you are looking for, where the "Main" information is an LSTM layer (which you'd do for the stock prices), and the "Auxiliary" information would be (Name of entity, Type Of entity , Size , Country, Specific Attributes) etc...

The model looks like this: Keras model

The example model actually uses 2 loss functions (2 outputs), but you can easily build it to only have the one output. The code is all there so will be easy to replicate.

I basically use this kind of model for almost everything now and get great results, vs just LSTM alone.

  • $\begingroup$ Looks interesting, will definitely, give it a try $\endgroup$
    – Shakti
    Apr 13, 2017 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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