LESSON 52 OF 52 · CHAPTER 06

Matrix Probabilities

Equal-score softmax and categorical-loss tolerance check

ORIGINAL SOURCE

11-matrix-probabilities.srp

bind weights = tile([1.0, 0.0, 0.0, 1.0], 2, 2);
bind scores = matvec(weights, [0.0, 0.0]);
print(softmax(scores));
bind loss = crossentropy(scores, 1);
print(loss > 0.6931 and loss < 0.6932);
EXPECTED OUTPUT

stdout

Verified
[0.5, 0.5]
true

UNDERSTAND THE CODE

Explanation & practice

What this example teaches

Equal-score softmax and categorical-loss tolerance check

Expected behavior

[0.5, 0.5], then true

Practice: Read the source before looking at the output. Predict the values and their order, then use the pinned compiler to execute this lesson and compare the exact fixture. Identify which operation produces the result.

स्कोर से संख्यात्मक संभावनाएँ

पहचान मैट्रिक्स (tile) और शून्य फीचर से दोनों वर्गों के बराबर स्कोर मिलते हैं। softmax दोनों को 0.5 देता है। crossentropy(scores, 1) का परिणाम 0.6931 से 0.6932 के बीच है—इसलिए प्रोग्राम true दिखाता है। इससे कोई प्रशिक्षित मॉडल या स्वचालित ग्रेडिएंट प्रणाली सिद्ध नहीं होती।

आउटपुट: पहली लाइन [0.5, 0.5], दूसरी true।

अभ्यास: दो बराबर स्कोर से दो बराबर संभावनाएँ क्यों बनती हैं, और लॉस को सटीक बराबरी के बजाय दायरे में क्यों जाँचा गया?

Explanations are sourced from the project's English chapter guide and हिन्दी अध्याय. The Scarp program and output are unchanged.

TRY IT LOCALLY

Verify, then execute

Use the pinned compiler from the course root. Keep any imported _support files next to the source.

scarp verify examples/06-ai-foundations/11-matrix-probabilities.srp scarp exec examples/06-ai-foundations/11-matrix-probabilities.srp

The website does not run code. Read the CLI guide ↗

CHAPTER 06 · LAST LESSON

Ready for your next step? · आगे क्या सीखें?

This is the final example in this chapter. Try its verified coding lab before moving on. Your lesson progress changes only when you mark a lesson complete.

Pinned compiler: Scarp v0.0.6-alpha.3 · ceff07d9014f. No simulated output.