Implement the softmax activation function. Given a list of values, compute the softmax probabilities so they sum to 1.
import math
def softmax(scores: list[float]) -> list[float]:
# Subtract max for numerical stability
max_score = max(scores)
exp_scores = [math.exp(s - max_score) for s in scores]
total = sum(exp_scores)
return [round(e / total, 4) for e in exp_scores]