fix: graphe calculation
This commit is contained in:
@@ -906,14 +906,9 @@ def analyze_event(body: AnalyzeRequest):
|
|||||||
node_range = cfg.get("range")
|
node_range = cfg.get("range")
|
||||||
if node_range and len(node_range) == 2:
|
if node_range and len(node_range) == 2:
|
||||||
lo, hi = float(node_range[0]), float(node_range[1])
|
lo, hi = float(node_range[0]), float(node_range[1])
|
||||||
bound = max(abs(lo), abs(hi))
|
inputs[input_id] = round(max(lo, min(hi, raw)), 4)
|
||||||
if bound <= 10:
|
|
||||||
# Plage type z-score : normalise surprise_pct → [-bound, +bound]
|
|
||||||
inputs[input_id] = round(max(lo, min(hi, raw / 100 * bound)), 4)
|
|
||||||
else:
|
|
||||||
inputs[input_id] = round(max(lo, min(hi, raw)), 4)
|
|
||||||
else:
|
else:
|
||||||
inputs[input_id] = round(raw / 100, 4) # fractional par défaut
|
inputs[input_id] = round(raw, 4)
|
||||||
elif src == "impact_score_scaled" and event.get("impact_score") is not None:
|
elif src == "impact_score_scaled" and event.get("impact_score") is not None:
|
||||||
inputs[input_id] = float(event["impact_score"]) / 10.0
|
inputs[input_id] = float(event["impact_score"]) / 10.0
|
||||||
elif src == "impact_score_pct" and event.get("impact_score") is not None:
|
elif src == "impact_score_pct" and event.get("impact_score") is not None:
|
||||||
@@ -1239,13 +1234,9 @@ def _run_auto_analysis(event: dict, template_id: int) -> dict:
|
|||||||
else:
|
else:
|
||||||
if node_range and len(node_range) == 2:
|
if node_range and len(node_range) == 2:
|
||||||
lo, hi = float(node_range[0]), float(node_range[1])
|
lo, hi = float(node_range[0]), float(node_range[1])
|
||||||
bound = max(abs(lo), abs(hi))
|
inputs[input_id] = round(max(lo, min(hi, raw)), 4)
|
||||||
if bound <= 10:
|
|
||||||
inputs[input_id] = round(max(lo, min(hi, raw / 100 * bound)), 4)
|
|
||||||
else:
|
|
||||||
inputs[input_id] = round(max(lo, min(hi, raw)), 4)
|
|
||||||
else:
|
else:
|
||||||
inputs[input_id] = round(raw / 100, 4)
|
inputs[input_id] = round(raw, 4)
|
||||||
|
|
||||||
elif src == "impact_score_scaled" and event.get("impact_score") is not None:
|
elif src == "impact_score_scaled" and event.get("impact_score") is not None:
|
||||||
inputs[input_id] = float(event["impact_score"]) / 10.0
|
inputs[input_id] = float(event["impact_score"]) / 10.0
|
||||||
|
|||||||
Reference in New Issue
Block a user