gm-spacagna / deep-ttf

Survival analsyis and time-to-failure predictive modeling using Weibull distributions and Recurrent Neural Networks in Keras
234 stars 95 forks source link

Adding Layers #8

Open EdMwa opened 5 years ago

EdMwa commented 5 years ago

How can we add more layers to this model? I tried adding layers and kept getting this error: "ValueError: Input 0 is incompatible with layer gru_19: expected ndim=3, found ndim=2"

I was experimenting adding a simple GRU layer like this: model.add(GRU(40, activation = 'tanh'))

Mapudi commented 5 years ago

Hi Did you manage to sort this issue out?

gm-spacagna commented 5 years ago

You need 3 dimensions to represent time-series on different features.

gyoseokchu commented 4 years ago

Hi EdMwa,

You need to add "return_sequences=True" parameter to the layers except the last recurrent layer.

For example,

model.add(GRU(50, activation='tanh', recurrent_dropout=0.25, return_sequences=True)) model.add(GRU(50, activation='tanh', recurrent_dropout=0.25, return_sequences=True)) model.add(GRU(50, activation='tanh', recurrent_dropout=0.25))