im trying to use LSTM ondataset which include milions of record event parking occupancy.
I decide to focus only on one device with higher frequency(around 17k rows) and that leads to my goal which is prediction of free/occupatied parking space based on information from past. Long time ago some generous people here on stack suggest to consider this problem as a time-series problem and that’s why i’m here with some questions about approach to LSTM in binary classification.
I followed instruction:
I guess i looked through whole internet to find similare dataset and that’s why im confused.
Based on article (and yt video) from curiousily i follow advice to take my data
- Put arrivaltime variable into index. (but make additional columns that represent arrivaltime_week, arrivaltime_minute, arrivaltime_hour, arrivaltime_dayofweek)
- I also have departuretime but i drop that column because i think duration in minutes will be sufficent
- I reshaped and scale my dataset
- Build lstm model
There is possible to exist few 0 (false) examples in a row. Idk why but i guess sensors usually make random event.
To be more clear, There is no simple schema in time that device recorded as you can notice on example dataset below
| | durationminutes| vehiclePresent | | -------- -----------| -------------- | ------------- | | 2019-05-28 02:50:42 | 9 | 0 | | 2019-05-28 02:59:10 | 1 | 1 | | 2019-05-28 03:00:50 | 16 | 0 | | 2019-05-28 03:16:35 | 7 | 1 | | 2019-05-28 03:23:27 | 16 | 0 |
model = keras.Sequential() model.add( keras.layers.Bidirectional( keras.layers.LSTM( units=128, return_sequences = False, input_shape=(X_train.shape, X_train.shape) ) ) ) model.add(keras.layers.Dropout(rate=0.2)) model.add((Dense(1, activation='sigmoid'))) #model.add(keras.layers.Dense(units=1)) model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) history = model.fit( X_train, y_train, epochs=20, batch_size=42, validation_split=0.1, shuffle=False )
To sum up:
-results are weird, before i was build lstm model without sigmoid function and mix some parameters but in any case it showed like the model overfit.
-It’s my first attempt to neural network so i’m like "what’s going on?"
I eager to know your point of view. Is my model is alright, is it even possible to work with time series liek this without time structured in one schema (like only ex. 14:05, 14:10, 14:15)
Big thanks for help!
Source: Python Questions