yonatane22-bh commited on
Commit
fdbd2cc
Β·
verified Β·
1 Parent(s): 07deebd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +40 -26
README.md CHANGED
@@ -26,13 +26,11 @@ tags:
26
 
27
  ---
28
 
29
- ## Overview
30
 
31
- Security Operations Centers (SOCs) are drowning in alerts. Every day, analysts receive thousands of automated security notifications β€” and the majority of them turn out to be noise. Studies show that **40-60% of SOC analyst time** is spent reviewing false positives: alerts that turn out to be harmless activity or just bad detections. The real threats get buried under the volume.
32
 
33
- In this assignment, I built a machine learning pipeline to predict whether a cybersecurity alert represents a confirmed attack (TruePositive), harmless activity (BenignPositive), or a false alarm (FalsePositive) β€” using only the structural features available the moment an alert fires, before any human analyst reviews it. If a model can automate the easy calls, analysts can focus their energy on the genuinely ambiguous cases.
34
-
35
- I found this dataset surprisingly rich. The 4.1 million evidence rows compress into meaningful incident-level patterns that a classifier can actually learn. The main challenge was figuring out which features encode real threat signal versus which ones just memorize organizational patterns β€” and that distinction turned out to matter a lot for building a model that generalizes.
36
 
37
  ---
38
 
@@ -41,9 +39,10 @@ I found this dataset surprisingly rich. The 4.1 million evidence rows compress i
41
  - **Source:** (https://archive.ics.uci.edu/dataset/498/incident+management+process+enriched+event+log)
42
  - **Original size:** 4.1M evidence-level rows, 45 features
43
  - **After cleaning:** 100K sampled rows, 35 features (10 dropped for >60% missing)
44
- - **Regression target:** `evidence_count` β€” number of evidence items per incident (proxy for complexity)
45
- - **Classification target:** `IncidentGrade` β€” TruePositive / BenignPositive / FalsePositive
46
- - **Class distribution:** BP 42% / TP 36% / FP 22%
 
47
 
48
  ## Feature Engineering
49
 
@@ -67,22 +66,18 @@ I also added clustering-derived features:
67
  ---
68
 
69
  ## Data Cleaning
 
70
 
71
  ### Missing Values
72
 
73
- Ten columns had more than 60% missing values and were dropped immediately. Keeping them would have meant imputing most of the data, which introduces more noise than signal.
74
-
75
- Dropped: `ActionGrouped`, `ActionGranular`, `ResourceType`, `ThreatFamily`, `AntispamDirection`, `Roles`, `EmailClusterId`, `SuspicionLevel`, `LastVerdict`, `MitreTechniques`
76
-
77
- I also removed `OrgId` after discovering it caused data leakage β€” early models achieved RΒ² = 0.88 by memorizing which organizations generate more incidents rather than learning actual threat patterns. Dropping it brought RΒ² to 0.47, which is a real score on real signal.
78
 
79
  ### Duplicates
80
 
81
  No duplicate rows found in the 100K sample.
82
 
83
  ### Outliers
84
-
85
- I kept the outliers in `evidence_count`. The distribution is bimodal β€” incidents either have very few evidence items (5-10) or very many (100-200). This initially looked like outliers, but it's a real operational pattern: simple false alarms generate minimal evidence while real attacks generate cascading evidence chains. Removing them would have destroyed the main signal.
86
 
87
  ---
88
 
@@ -92,25 +87,28 @@ I kept the outliers in `evidence_count`. The distribution is bimodal β€” inciden
92
 
93
  ![Grade Distribution](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/01_grade_distribution.png)
94
 
95
- The dataset is moderately imbalanced: **42% BenignPositive**, **36% TruePositive**, **22% FalsePositive**. A model that predicts everything as BP would score 42% accuracy without learning anything. I used macro F1-score throughout to give equal weight to all three classes.
 
 
96
 
97
  ### Entity Type Patterns
98
 
99
  ![Entity Type by Grade](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/02_entity_type_by_grade.png)
100
 
101
- IP-based entities dominate confirmed attacks β€” the `Ip` entity type has the highest TruePositive count at roughly 11K incidents. CloudLogonRequest stood out with almost zero BenignPositive, meaning flagged cloud logins are either real threats or false alarms, never routine activity.
 
 
102
 
103
  ### Threat Category Profiles
104
 
105
  ![Category by Grade](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/03_category_by_grade.png)
106
 
107
- This was the most revealing visualization. Different threat categories have completely different noise levels. Malware alerts are **74% BenignPositive** β€” most antivirus triggers are harmless. InitialAccess alerts are **54% TruePositive** β€” when someone is trying to get into a system, it's usually real. Category alone gives you a strong prior on whether an alert deserves investigation.
108
-
109
- ### Evidence Volume by Grade
 
110
 
111
- ![Evidence by Grade](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/05_evidence_by_grade.png)
112
-
113
- Real attacks leave a much larger forensic trail. TruePositive incidents average **117 evidence items** compared to 25 for FalsePositive β€” a **4.7Γ— difference**. This confirmed that deriving `evidence_count` as a regression target was the right approach.
114
 
115
  ---
116
 
@@ -150,23 +148,39 @@ Real attacks leave a much larger forensic trail. TruePositive incidents average
150
 
151
  ![Baseline Evaluation](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/07_baseline_eval.png)
152
 
153
- The baseline LinearRegression on 6 encoded categorical features scored RMSE = 96.1, RΒ² = 0.023. The residual plot showed two distinct peaks β€” a clear sign the linear model was failing to capture the bimodal distribution of evidence counts.
 
 
 
154
 
155
  ### Regression Model Comparison
156
 
157
  ![Regression Comparison](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/09_regression_comparison.png)
158
 
159
  ![Regression Importance](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/10_regression_importance.png)
 
 
 
 
 
 
 
 
160
 
161
  ![Winner Regression Eval](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/11_winner_regression_eval.png)
162
 
163
- After adding the 5 engineered features plus clustering, RandomForest dropped RMSE to **70.9** β€” a **26% improvement** over baseline. RΒ² rose from 0.023 to 0.469. Tree models handle the bimodal target distribution naturally by splitting the data rather than trying to fit a single line.
 
 
 
164
 
165
  ### Classification Setup
166
 
167
  ![Grade Distribution](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/12_grade_distribution.png)
168
 
169
- I used `IncidentGrade` directly without any conversion β€” the three classes already existed in the dataset. The class imbalance (42/36/22) made macro F1 the right metric to ensure the model learned all three classes equally.
 
 
170
 
171
  ### Classification Results
172
 
 
26
 
27
  ---
28
 
29
+ ## The Problem
30
 
31
+ SOC analysts waste **40-60% of their time** reviewing false positives. Out of 1000 daily alerts, ~600 are noise. Real threats get buried.
32
 
33
+ **Goal:** Build ML models to automate triage β€” predict if an alert is a real attack (TP), harmless activity (BP), or false alarm (FP).
 
 
34
 
35
  ---
36
 
 
39
  - **Source:** (https://archive.ics.uci.edu/dataset/498/incident+management+process+enriched+event+log)
40
  - **Original size:** 4.1M evidence-level rows, 45 features
41
  - **After cleaning:** 100K sampled rows, 35 features (10 dropped for >60% missing)
42
+ - **Targets:**
43
+ - Regression: `evidence_count` (attack complexity)
44
+ - Classification: `IncidentGrade` (TP/BP/FP)
45
+ - **Class split:** 42% BP / 36% TP / 22% FP
46
 
47
  ## Feature Engineering
48
 
 
66
  ---
67
 
68
  ## Data Cleaning
69
+ Removed `OrgId` β†’ caused data leakage (RΒ² 0.88 β†’ 0.47)
70
 
71
  ### Missing Values
72
 
73
+ Ten columns had more than 60% missing values and were dropped immediately. to prevent capturing more noise than signal.
 
 
 
 
74
 
75
  ### Duplicates
76
 
77
  No duplicate rows found in the 100K sample.
78
 
79
  ### Outliers
80
+ Kept outliers in `evidence_count` β†’ bimodal distribution is real signal
 
81
 
82
  ---
83
 
 
87
 
88
  ![Grade Distribution](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/01_grade_distribution.png)
89
 
90
+ **Shows:** Class distribution of incident grades
91
+ **Finding:** 42% BenignPositive, 36% TruePositive, 22% FalsePositive
92
+ **Why it matters:** Moderate imbalance β†’ used macro F1 metric (equal weight to all classes)
93
 
94
  ### Entity Type Patterns
95
 
96
  ![Entity Type by Grade](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/02_entity_type_by_grade.png)
97
 
98
+ **Shows:** Which entity types (IP, User, Machine, etc.) appear in each grade
99
+ **Finding:** IP entities dominate TruePositive incidents (~11K count)
100
+ **Why it matters:** IP-based alerts deserve higher priority than User-based alerts
101
 
102
  ### Threat Category Profiles
103
 
104
  ![Category by Grade](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/03_category_by_grade.png)
105
 
106
+ **Shows:** Threat categories (InitialAccess, Malware, Exfiltration, etc.) by grade
107
+ **Finding:**
108
+ - InitialAccess: 54% TruePositive (high threat)
109
+ - Malware: 74% BenignPositive (mostly noise)
110
 
111
+ **Why it matters:** Not all alert categories are equal β€” category alone is a strong predictor
 
 
112
 
113
  ---
114
 
 
148
 
149
  ![Baseline Evaluation](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/07_baseline_eval.png)
150
 
151
+ **Shows:** LinearRegression performance β€” residual plot
152
+ **Finding:** Two distinct peaks β†’ bimodal distribution not captured
153
+ **Result:** RMSE = 96.1, RΒ² = 0.023 (failed)
154
+ **Why it matters:** Linear models can't handle this data β†’ need tree models
155
 
156
  ### Regression Model Comparison
157
 
158
  ![Regression Comparison](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/09_regression_comparison.png)
159
 
160
  ![Regression Importance](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/10_regression_importance.png)
161
+ **Shows:** RandomForest feature importance for regression
162
+ **Finding:**
163
+ - AlertTitle: **61% importance**
164
+ - cluster_distance: 30%
165
+ - Category: 15%
166
+
167
+ **Why it matters:** Which detector fired is by far the strongest predictor
168
+
169
 
170
  ![Winner Regression Eval](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/11_winner_regression_eval.png)
171
 
172
+ **Shows:** RandomForest actual vs predicted scatter plot
173
+ **Finding:** Good fit along diagonal β€” captures bimodal pattern
174
+ **Why it matters:** Tree splits naturally handle 25-item vs 117-item peaks
175
+
176
 
177
  ### Classification Setup
178
 
179
  ![Grade Distribution](https://huggingface.co/yonatane22-bh/Microsoft_SOC_analysis/resolve/main/figures/12_grade_distribution.png)
180
 
181
+ **Shows:** Target class distribution for classification task
182
+ **Finding:** Same 42/36/22 split as before
183
+ **Why it matters:** Confirms macro F1 is right metric (not accuracy)
184
 
185
  ### Classification Results
186