Update phase/interpret.py
Browse files- phase/interpret.py +24 -24
phase/interpret.py
CHANGED
|
@@ -1,25 +1,25 @@
|
|
| 1 |
-
def assign_typology(sorted_components, high_th=0.4, th=0.2):
|
| 2 |
-
|
| 3 |
-
high_impact = []
|
| 4 |
-
medium_impact = []
|
| 5 |
-
low_impact = []
|
| 6 |
-
|
| 7 |
-
for component, data in sorted_components.items():
|
| 8 |
-
entry = {
|
| 9 |
-
"component": component,
|
| 10 |
-
"value": data["value"],
|
| 11 |
-
"description": data.get("description", "")
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
if abs(data["value"]) >= high_th:
|
| 15 |
-
high_impact.append(entry)
|
| 16 |
-
elif abs(data["value"]) >= th:
|
| 17 |
-
medium_impact.append(entry)
|
| 18 |
-
else:
|
| 19 |
-
low_impact.append(entry)
|
| 20 |
-
|
| 21 |
-
return {
|
| 22 |
-
"high": high_impact,
|
| 23 |
-
"medium": medium_impact,
|
| 24 |
-
"low": low_impact
|
| 25 |
}
|
|
|
|
| 1 |
+
def assign_typology(sorted_components, high_th=0.4, th=0.2):
|
| 2 |
+
|
| 3 |
+
high_impact = []
|
| 4 |
+
medium_impact = []
|
| 5 |
+
low_impact = []
|
| 6 |
+
|
| 7 |
+
for component, data in sorted_components.items():
|
| 8 |
+
entry = {
|
| 9 |
+
"component": component,
|
| 10 |
+
"value": data["value"],
|
| 11 |
+
"description": data.get("description", "")
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
if abs(data["value"]) >= high_th:
|
| 15 |
+
high_impact.append(entry)
|
| 16 |
+
elif abs(data["value"]) >= th:
|
| 17 |
+
medium_impact.append(entry)
|
| 18 |
+
else:
|
| 19 |
+
low_impact.append(entry)
|
| 20 |
+
|
| 21 |
+
return {
|
| 22 |
+
"high": high_impact,
|
| 23 |
+
"medium": medium_impact,
|
| 24 |
+
"low": low_impact
|
| 25 |
}
|