Softmax Weights
Turn scores into probabilities: compute e ** score for every score (np.exp) and divide each by the sum of all of them, so the results add up to 1. Return the array of probabilities.
Example 1
scores [0,0]
returns [0.5,0.5]
Equal scores give equal shares: [0.5, 0.5].
Constraints
1 <= len(scores) <= 20- Scores are between -10 and 10
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Sort Each RowEasy
- Strong RowsEasy
- Total Over LimitEasy
- Trend SlopeEasy
- Trimmed MeanEasy
- Vector DistanceEasy
- Weighted AverageEasy
- Weighted Row ScoresEasy