Exercises / math
Cross-entropy of a one-hot
ce(q, k) is -log2 of q[k], with a floor of 1e-12 on q[k]. Print ce of [0.1, 0.8, 0.1] at index 1, rounded to 3 decimals.
Live Pythonpython
Output
Run to execute this in your browser. Nothing is sent to a server.