Spaces:
Runtime error
Runtime error
| def map_feature_group(idx): | |
| if idx < 8: | |
| return "Statistical" | |
| elif idx < 8 + 5: | |
| return "AST" | |
| elif idx < 8 + 5 + 11: | |
| return "Stylometry" | |
| elif idx < 8 + 5 + 11 + 2: | |
| return "Language" | |
| else: | |
| return "Semantic" | |
| def group_shap_explanations(shap_result): | |
| grouped = {} | |
| for item in shap_result: | |
| group = map_feature_group(item["feature_index"]) | |
| grouped.setdefault(group, 0) | |
| grouped[group] += abs(item["impact"]) | |
| return grouped |