def score_from_children()

in project/paperbench/paperbench/judge/judge.py [0:0]


def score_from_children(children: list[GradedTaskNode]) -> float:
    """
    Calculate the weighted score accumulated from a list of graded children.
    """
    total_weight = sum(child.weight for child in children)
    if total_weight == 0:
        return 0.0
    weighted_score = sum(child.score * child.weight for child in children) / total_weight
    return weighted_score