🔁
Bidirectional LSTM (biLSTM)
Bidirectional LSTM (biLSTM) is a type of recurrent neural network that uses two LSTM layers: one processes the sequence forward, the other backward. This allows the model to capture information from both past and future time steps, making it powerful for sequence modeling and time series forecasting.
Key Features
- Captures dependencies in both directions (past and future).
- Handles long-term dependencies and vanishing gradient problem.
- Widely used in time series, NLP, and speech recognition.
- More expressive than vanilla RNNs and GRUs.
Architecture
Illustrative Architecture (SVG)
Python Example (Keras)
from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Bidirectional, LSTM, Dense model = Sequential([ Bidirectional(LSTM(64, return_sequences=True), input_shape=(timesteps, features)), Bidirectional(LSTM(32)), Dense(1) ]) model.compile(optimizer='adam', loss='mse') model.summary()
Use Cases
- Time series forecasting (energy, finance, weather, etc.)
- Natural language processing (NLP)
- Speech recognition
- Sequence labeling and classification