Skip to content

Commit 68284bd

Browse files
committed
ss to be added
1 parent d88cb35 commit 68284bd

File tree

1 file changed

+84
-61
lines changed

1 file changed

+84
-61
lines changed
Lines changed: 84 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
1-
# Time-Series Anomaly Detection
1+
# 📜 Time-Series Anomaly Detection
22

3-
### AIM
3+
<div align="center">
4+
<img src="https://fr.mathworks.com/help/examples/nnet/win64/TimeSeriesAnomalyDetectionUsingDeepLearningExample_08.png" />
5+
</div>
46

7+
## 🎯 AIM
58
To detect anomalies in time-series data using Long Short-Term Memory (LSTM) networks.
69

7-
### DATASET
10+
## 📊 DATASET LINK
11+
[NOT USED]
812

9-
Synthetic time-series data generated using sine wave with added noise.
10-
11-
### KAGGLE NOTEBOOK
13+
## 📓 KAGGLE NOTEBOOK
1214
[https://www.kaggle.com/code/thatarguy/lstm-anamoly-detection/notebook](https://www.kaggle.com/code/thatarguy/lstm-anamoly-detection/notebook)
1315

14-
### LIBRARIES NEEDED
16+
??? Abstract "Kaggle Notebook"
17+
18+
</iframe>
19+
<iframe src="https://www.kaggle.com/embed/thatarguy/lstm-anamoly-detection?kernelSessionId=222020820" height="800" style="margin: 0 auto; width: 100%; max-width: 950px;" frameborder="0" scrolling="auto" title="lstm anamoly detection"></iframe>
1520

16-
- numpy
17-
- pandas
18-
- yfinance
19-
- matplotlib
20-
- tensorflow
21-
- scikit-learn
21+
## ⚙️ TECH STACK
22+
23+
| **Category** | **Technologies** |
24+
|--------------------------|---------------------------------------------|
25+
| **Languages** | Python |
26+
| **Libraries/Frameworks** | TensorFlow, Keras, scikit-learn, numpy, pandas, matplotlib |
27+
| **Tools** | Jupyter Notebook, VS Code |
2228

2329
---
2430

25-
### DESCRIPTION
31+
## 📝 DESCRIPTION
2632

2733
!!! info "What is the requirement of the project?"
2834
- The project focuses on identifying anomalies in time-series data using an LSTM autoencoder. The model learns normal patterns and detects deviations indicating anomalies.
@@ -47,79 +53,98 @@ Synthetic time-series data generated using sine wave with added noise.
4753

4854
---
4955

50-
### Model Architecture
51-
- The LSTM autoencoder learns normal time-series behavior and reconstructs it. Any deviation is considered an anomaly.
52-
- Encoder: Extracts patterns using LSTM layers.
53-
- Bottleneck: Compresses the data representation.
54-
- Decoder: Reconstructs the original sequence.
55-
- The reconstruction error determines anomalies.
56-
57-
### Model Structure
58-
- Input: Time-series sequence (50 time steps)
59-
- LSTM Layers for encoding
60-
- Repeat Vector to retain sequence information
61-
- LSTM Layers for decoding
62-
- TimeDistributed Dense Layer for reconstruction
63-
- Loss Function: Mean Squared Error (MSE)
56+
## 🔍 PROJECT EXPLANATION
57+
58+
### 🧩 DATASET OVERVIEW & FEATURE DETAILS
59+
60+
??? example "📂 Synthetic dataset"
61+
62+
- The dataset consists of a sine wave with added noise.
63+
64+
| Feature Name | Description | Datatype |
65+
|--------------|-------------|:------------:|
66+
| time | Timestamp | int64 |
67+
| value | Sine wave value with noise | float64 |
6468

6569
---
6670

67-
#### WHAT I HAVE DONE
71+
### 🛤 PROJECT WORKFLOW
6872

69-
=== "Step 1"
73+
!!! success "Project workflow"
7074

71-
Exploratory Data Analysis
75+
``` mermaid
76+
graph LR
77+
A[Start] --> B{Generate Data};
78+
B --> C[Normalize Data];
79+
C --> D[Create Sequences];
80+
D --> E[Train LSTM Autoencoder];
81+
E --> F[Compute Reconstruction Error];
82+
F --> G[Identify Anomalies];
83+
```
7284

85+
=== "Step 1"
7386
- Generate synthetic data (sine wave with noise)
7487
- Normalize data using MinMaxScaler
7588
- Split data into training and validation sets
7689

7790
=== "Step 2"
78-
79-
Data Cleaning and Preprocessing
80-
8191
- Create sequential data using a rolling window approach
8292
- Reshape data for LSTM compatibility
8393

8494
=== "Step 3"
95+
- Implement LSTM autoencoder for anomaly detection
96+
- Optimize model using Adam optimizer
8597

86-
Feature Engineering and Selection
98+
=== "Step 4"
99+
- Compute reconstruction error for anomaly detection
100+
- Identify threshold for anomalies using percentile-based method
87101

88-
- Use LSTM layers for sequence modeling
89-
- Implement autoencoder-based reconstruction
102+
=== "Step 5"
103+
- Visualize detected anomalies using Matplotlib
90104

91-
=== "Step 4"
105+
---
92106

93-
Modeling
107+
### 🖥 CODE EXPLANATION
94108

95-
- Train an LSTM autoencoder
96-
- Optimize loss function using Adam optimizer
97-
- Monitor validation loss for overfitting prevention
109+
=== "LSTM Autoencoder"
110+
- The model consists of an encoder, bottleneck, and decoder.
111+
- It learns normal time-series behavior and reconstructs it.
112+
- Deviations from normal patterns are considered anomalies.
98113

99-
=== "Step 5"
114+
---
100115

101-
Result Analysis
116+
### ⚖️ PROJECT TRADE-OFFS AND SOLUTIONS
102117

103-
- Compute reconstruction error for anomaly detection
104-
- Identify threshold for anomalies using percentile-based method
105-
- Visualize detected anomalies using Matplotlib
118+
=== "Reconstruction Error Threshold Selection"
119+
- Setting a high threshold may miss subtle anomalies, while a low threshold might increase false positives.
120+
- **Solution**: Use the 95th percentile of reconstruction errors as the threshold to balance false positives and false negatives.
106121

107122
---
108123

109-
#### PROJECT TRADE-OFFS AND SOLUTIONS
124+
## 🖼 SCREENSHOTS
110125

111-
=== "Trade Off 1"
126+
!!! tip "Visualizations and EDA of different features"
112127

113-
**Reconstruction Error Threshold Selection:**
114-
Setting a high threshold may miss subtle anomalies, while a low threshold might increase false positives.
128+
=== "Synthetic Data Plot"
129+
115130

116-
- **Solution**: Use the 95th percentile of reconstruction errors as the threshold to balance false positives and false negatives.
131+
??? example "Model performance graphs"
132+
133+
=== "Reconstruction Error Plot"
117134

118135
---
119136

120-
### CONCLUSION
137+
## 📉 MODELS USED AND THEIR EVALUATION METRICS
121138

122-
#### WHAT YOU HAVE LEARNED
139+
| Model | Reconstruction Error (MSE) |
140+
|------------------|---------------------------|
141+
| LSTM Autoencoder | 0.015 |
142+
143+
---
144+
145+
## ✅ CONCLUSION
146+
147+
### 🔑 KEY LEARNINGS
123148

124149
!!! tip "Insights gained from the data"
125150
- Time-series anomalies often appear as sudden deviations from normal patterns.
@@ -133,15 +158,13 @@ Synthetic time-series data generated using sine wave with added noise.
133158

134159
---
135160

136-
#### USE CASES OF THIS MODEL
137-
138-
=== "Application 1"
161+
### 🌍 USE CASES
139162

140-
- Financial fraud detection through irregular transaction patterns.
163+
=== "Financial Fraud Detection"
164+
- Detect irregular transaction patterns using anomaly detection.
141165

142-
=== "Application 2"
166+
=== "Predictive Maintenance"
167+
- Identify equipment failures in industrial settings before they occur.
143168

144-
- Predictive maintenance in industrial settings by identifying equipment failures.
145169

146-
---
147170

0 commit comments

Comments
 (0)