Keras LSTM: modeling the layers

41 views Asked by At

I'm new to Keras LSTM and I building a script for prediction based on time series.

I have the data set below which describe users' power consumption in a year

User    mai/13  jun/13  jul/13  ago/13  set/13  out/13  nov/13  dez/13  jan/14  fev/14  mar/14  abr/14
x1  88  99  108 90  86  79  83  75  80  69  75  61
x2  0   143 163 127 174 199 177 140 100 100 130 119
x3  51  50  41  42  51  48  58  53  53  37  47  41
x4  181 211 166 105 128 123 125 98  114 58  4   0
x5  173 187 180 195 211 212 231 188 193 168 166 0
x6  343 321 293 272 400 397 467 392 409 306 408 353
x7  215 150 161 148 153 130 165 166 198 166 150 148
x8  100 140 132 119 121 125 148 135 144 123 124 16
x9  197 193 181 161 201 161 227 154 176 148 171 172
x10 356 371 347 347 363 377 423 373 395 338 337 302

For each user, my script split the data in windows with size n, i.e., if n=6, user x1 will have the following dataset

88  99  108 90  86  79
99  108 90  86  79  83
108 90  86  79  83  75
90  86  79  83  75  80
86  79  83  75  80  69
79  83  75  80  69  75
83  75  80  69  75  61

I want my net to learn from the patterns of each window, so when I'm going to test it, based on a new window, it predicts a value considering the previous values.

Considering these variables:

dataset_length => number of months
dataset_dim => number of users
sequence_length => window size

The net I'm thinking about is:

1st layer: LSTM with sequence_length units, input_shape(None, 1) and return_sequences set true
2nd layer: LSTM with sequence_length*2 units and return_sequences set false
3rd layer: Dense with 1 unit

Is there anything wrong on my net layout? I'm testing the net with a little bit more data and not getting a very good result (high loss). What can I change for a better prediction? Do I need more layers?

Please let me know if you need some piece of code or the test results.

0

There are 0 answers