-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
107 additions
and
0 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
docs/_notebooks/train_tonnage_anomaly_detection.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
--- | ||
# This is the Front Matter section where you can set variables used by Jekyll | ||
layout: post | ||
title: "Train Tonnage Anomaly Detection" | ||
date: 2024-03-16 19:26:31 +0000 | ||
categories: notebooks | ||
--- | ||
|
||
## Prerequisites | ||
* Configure RHODS workspace has been completed. | ||
|
||
## Run Jupyter notebooks | ||
1. Accessing an AWS S3 bucket & downloading multiple JSON files - [advanceddownloadData.ipynb](https://github.com/tosin2013/edge-anomaly-detection-notebooks/blob/main/advanceddownloadData.ipynb) | ||
|
||
**Data Collection** | ||
Change the following to notebook | ||
```python | ||
AWS_ACCESS_KEY_ID = 'YOUR_ACCESS_KEY' | ||
AWS_SECRET_ACCESS_KEY = 'YOUR_SECRET_KEY' | ||
bucket_name = 'edge-anomaly-detection-bucket-name' | ||
# List of file names to download | ||
file_names = [ | ||
'edge-datalake-bullet--Wed Oct 04 13:56:26 GMT 2023.txt', | ||
'edge-datalake-bullet--Wed Oct 04 13:57:26 GMT 2023.txt', | ||
# Add more file names here if needed | ||
] | ||
``` | ||
Example Bucket contents | ||
![20240318160248](https://i.imgur.com/Ie9u1JO.png) | ||
|
||
![20240318160350](https://i.imgur.com/piewUAs.png) | ||
|
||
### Train Tonnage Anomaly Detection Model - [TrainTonnage.ipynb](https://github.com/tosin2013/edge-anomaly-detection-notebooks/blob/main/TrainTonnage.ipynb) | ||
|
||
**Data Exploration** | ||
![20240318160746](https://i.imgur.com/QvAvfc3.png) | ||
**Preprocess the data (remove rows with missing values)** | ||
![20240318160826](https://i.imgur.com/epkYtgu.png) | ||
|
||
**Make an Isolation Forest Model** | ||
![20240318161314](https://i.imgur.com/vFhmhbf.png) | ||
|
||
**Show Anomalies** | ||
![20240318161351](https://i.imgur.com/9B2nMEM.png) | ||
|
||
**Check the Correlations in the Data** | ||
![20240318161420](https://i.imgur.com/7VA62H1.png) | ||
|
||
**Check fo Missing Data in the Dataset** | ||
![20240318161455](https://i.imgur.com/Y89ll2F.png) | ||
|
||
**Detect Negative Values in the 'TrainSpeed' Column** | ||
![20240318161529](https://i.imgur.com/jsiudcG.png) | ||
|
||
**Print the Anomaly Scores and Correlation Matrix** | ||
![20240318161605](https://i.imgur.com/iDBBnRn.png) | ||
|
||
**Train Tonnage Over Time with Anomalies Highlighted** | ||
![20240318161633](https://i.imgur.com/b5o2gUx.png) | ||
|
||
**List Detected Anomalies in Train Tonnage Data** | ||
![20240318161705](https://i.imgur.com/UaGNTrC.png) | ||
|
||
**Visualize of All Dataframe Columns** | ||
![20240318161922](https://i.imgur.com/PLjcIj0.png) | ||
|
||
**Visualize All Anomalies Dataframe Columns** | ||
![20240318161950](https://i.imgur.com/q7FV9HF.png) | ||
|
||
**Correlation Heatmap** | ||
![20240318162010](https://i.imgur.com/zXGYS7M.png) | ||
|
||
**Review Box Plot of Key Features** | ||
![20240318162037](https://i.imgur.com/fZOPfHA.png) | ||
|
||
**Pairwise Scatter Plot of Key Features** | ||
![20240318162107](https://i.imgur.com/Xa62nYe.png) | ||
|
||
**Scatter Plot of Primary Suspension Stiffness vs. Train Acceleration** | ||
![20240318162134](https://i.imgur.com/SjQpBRm.png) | ||
|
||
**Scatter Plot of Train Tonnage vs. Elapsed Time** | ||
![20240318162205](https://i.imgur.com/BLUvhML.png) | ||
|
||
**Scatter Plot of Train Tonnage vs. Anomaly Scores** | ||
![20240318162230](https://i.imgur.com/wSuNPsM.png) | ||
|
||
**Scatter Plot of Anomaly vs. Anomaly Scores** | ||
![20240318162252](https://i.imgur.com/mISPuIX.png) | ||
|
||
**Scatter Plot of TrainSpeed vs. TrainAcceleration with Correlation Line** | ||
![20240318162331](https://i.imgur.com/tackNTQ.png) | ||
|
||
**Model Conversion to ONNX Format** | ||
|
||
**Load an ONNX Model for Inference** | ||
|
||
**List Features in a Sample DataFrame** | ||
![20240318163307](https://i.imgur.com/3ySqXky.png) | ||
|
||
**Feature Extraction and Inference** | ||
|
||
**Inference using ONNX Model** | ||
|
||
**Visualizing Model Output with a Bar Chart** | ||
|
||
**Visualizing Anomaly Scores with a Bar Chart** |