Skip to content

Softmax: Update output values in Example 2#249

Merged
kunal-mansukhani merged 1 commit intoAlphaGPU:mainfrom
ElieDeBrauwer:patch-1
Apr 19, 2026
Merged

Softmax: Update output values in Example 2#249
kunal-mansukhani merged 1 commit intoAlphaGPU:mainfrom
ElieDeBrauwer:patch-1

Conversation

@ElieDeBrauwer
Copy link
Copy Markdown
Contributor

The following python code:

def softmax(input_list):
    max_val = max(input_list)
    exps = [pow(2.718281828459, x - max_val) for x in input_list]
    sum_exps = sum(exps)
    return [e / sum_exps for e in exps]

data = [-10.0, -5.0, 0.0, 5.0, 10.0]

probabilities = softmax(data)

print(f"{'Input':<10} | {'Standard Notation':<15} | {'Scientific Notation'}")
print("-" * 55)

for val, prob in zip(data, probabilities):
    print(f"{val:<10} | {prob:<15.10f} | {prob:.3e}")

Produces the following output:

Input      | Standard Notation | Scientific Notation
-------------------------------------------------------
-10.0      | 0.0000000020    | 2.047e-09
-5.0       | 0.0000003038    | 3.038e-07
0.0        | 0.0000450940    | 4.509e-05
5.0        | 0.0066925471    | 6.693e-03
10.0       | 0.9932620530    | 9.933e-01

This PR ensures the description is in line with the correct values.

Example 2 contains some values which were wrong.
@kunal-mansukhani kunal-mansukhani merged commit 0fc5028 into AlphaGPU:main Apr 19, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants