/sens-ad

LSTM model for the purpose of anomaly detection in multivariate sensor timeseries

Primary LanguageJupyter NotebookMIT LicenseMIT

Log/Sensor Anomaly Detector

With regard to the latest developments in the ISO/IEEE 11073 service-oriented device connectivity (SDC) its important to not leave possible security and safety risks of this new communication protocol out of consideration. Therefore the basic idea of this project (carried out during the author's bachelor thesis) was to improve the security as well as the safety of sdc connected medical devices with ML based anomaly detection. The concept is illustrated in the following chart: Concept So the safety and security system is itemized in two anomaly detectors: one network intrusion detection system and one log/sensor anomaly detector (content of this repository). While the nids runs directly on the switch that interconnects different medical devices, the log anomaly detector runs in the backend.

Dependencies

The necessary dependencies are listed in requirements.txt: use pip install -r requirements.txt to install all suitable versions. Additionally, for the synthetical data generation Matlab has to be installed with the Simscape Multibody Library. Further the Nvidia cuDNN library is needed to train and execute the LSTM model on your supported Nvidia GPU.

Underlying papers and informations

Usage steps

Training and execution of the model

  • LSTM_forecast.py: specifies the structure of the LSTM model and is used to train it
  • run LSTM_exec.py to execute the trained model on the test data

Synthetical data generation

  • DC_Motor_simscape.slx

Results/Evaluation

Model structure

ForecastSruct

Forecasting

forecastTestDC

Mean Absolute Error and Threshold

detectionTestDC

Metrics, runtime and required resources

Metrics Engine Error run in mechanical stop
TPR 0.8328 0.9251
FPR 0.0080 0.0086
F-Score 0.8866 0.9364
  • runtime (on GPU): 7 ms per prediction
  • resources: 2411 MB

For limitations and further improvements, see TODO.txt