Update detection results to use correct key names for scores
Corrects the key names used to retrieve detection results in `compare_models.py` to match the output format of the hybrid detector. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 600ade79-ad9b-4993-b968-e6466b703598 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/RJGlbTt
This commit is contained in:
parent
49eb9a9f91
commit
837f7d4c08
4
.replit
4
.replit
@ -18,10 +18,6 @@ externalPort = 80
|
|||||||
localPort = 41303
|
localPort = 41303
|
||||||
externalPort = 3002
|
externalPort = 3002
|
||||||
|
|
||||||
[[ports]]
|
|
||||||
localPort = 41797
|
|
||||||
externalPort = 3001
|
|
||||||
|
|
||||||
[[ports]]
|
[[ports]]
|
||||||
localPort = 43471
|
localPort = 43471
|
||||||
externalPort = 3003
|
externalPort = 3003
|
||||||
|
|||||||
@ -116,6 +116,13 @@ def reanalyze_with_hybrid(detector, ip_address, old_detection):
|
|||||||
new_detection = result[0]
|
new_detection = result[0]
|
||||||
|
|
||||||
# Confronto
|
# Confronto
|
||||||
|
new_score = new_detection.get('risk_score', 0)
|
||||||
|
new_type = new_detection.get('anomaly_type', 'unknown')
|
||||||
|
new_confidence = new_detection.get('confidence_level', 'unknown')
|
||||||
|
|
||||||
|
# Determina se è anomalia (score >= 80 = critical threshold)
|
||||||
|
new_is_anomaly = new_score >= 80
|
||||||
|
|
||||||
comparison = {
|
comparison = {
|
||||||
'ip_address': ip_address,
|
'ip_address': ip_address,
|
||||||
'logs_count': len(logs),
|
'logs_count': len(logs),
|
||||||
@ -126,14 +133,14 @@ def reanalyze_with_hybrid(detector, ip_address, old_detection):
|
|||||||
'old_blocked': old_detection['blocked'],
|
'old_blocked': old_detection['blocked'],
|
||||||
|
|
||||||
# Nuovo modello Hybrid (rianalisi)
|
# Nuovo modello Hybrid (rianalisi)
|
||||||
'new_score': new_detection.get('anomaly_score', 0),
|
'new_score': new_score,
|
||||||
'new_anomaly_type': new_detection.get('anomaly_type', 'unknown'),
|
'new_anomaly_type': new_type,
|
||||||
'new_confidence': new_detection.get('confidence', 'unknown'),
|
'new_confidence': new_confidence,
|
||||||
'new_is_anomaly': new_detection.get('is_anomaly', False),
|
'new_is_anomaly': new_is_anomaly,
|
||||||
|
|
||||||
# Delta
|
# Delta
|
||||||
'score_delta': new_detection.get('anomaly_score', 0) - float(old_detection['risk_score']),
|
'score_delta': new_score - float(old_detection['risk_score']),
|
||||||
'type_changed': old_detection['anomaly_type'] != new_detection.get('anomaly_type', 'unknown'),
|
'type_changed': old_detection['anomaly_type'] != new_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
return comparison
|
return comparison
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user