BILSTM
Description
This API calls the BILSTM model, which can be used for anomaly detection, classification, time series prediction, and forecasting.
BILSTM Model Architecture

Extends the functionality of the traditional LSTM (Long Short-Term Memory) network by adding an additional LSTM layer that processes the sequence in reverse order.
A typical BILSTM layer consists of:
- A forward LSTM layer.
- Process the sequence from start to end.
- A backward LSTM layer.
- Process the sequence from end to start.
Finally, the outputs of the two layers are combined (e.g., concatenated or averaged) to generate the final representation.
Key Features of BILSTM:
- Context Awareness
- Unlike standard LSTMs, which only consider past information, BILSTM uses both past and future context, making it more effective for tasks where the entire sequence context is important.
- Sequence Dependency Handling
- It excels in tasks where dependencies between distant time steps are critical.
- Flexibility
- Works well for time series data, text data, and any sequence data.
API module path
from api.v2.model.BILSTM import BiLSTM
Parameters
Input_dim
- Specifies the input feature size.
- Example
- If data's shape (x,x,1).
- input_dim = 1
Hidden_dim
- Specifies the hidden dim size.
- This value sets the number of nodes in the intermediate layer.
- Example
- This value is typically set as a power of 2.
- Hidden_dim = 64
Num_layer
- Specifies the number of LSTM layers.
- Example
- num_layers = 2
Output_dim
- Specifies the output dimension.
- The value varies depending on the objective of the model.
Dropout
- Specifies the dropout rate of LSTM layers.
- Default : 0.2
- Example
- dropout = 0.2
Use_revin
- Specifies whether to use RevIN normalization.
- default : False
- Example
- Use_revin = False
Example Sample Code (Python)
Results

Check the entire module code.
datahub/api/v2/model/BILSTM.py at main · machbase/datahub
All Industrial IoT DataHub with data visualization and AI source - machbase/datahub