[{"data":1,"prerenderedAt":960},["ShallowReactive",2],{"book-hierarchy":3,"content-query-jD1NoBr2Kh":199},[4,109],{"key":5,"slug":5,"title":6,"cleanTitle":6,"numberedTitle":6,"description":7,"path":7,"sourcePath":7,"aliases":8,"basePath":9,"filePath":7,"pageType":7,"hidden":10,"effectiveHidden":10,"order":-4,"depth":11,"number":7,"ownAudience":7,"audiences":12,"coverDeLight":7,"coverEnLight":7,"coverDeDark":7,"coverEnDark":7,"children":14},"_info","Info","",[],"/_info",false,1,[13],"Sek I",[15,31,45,59],{"key":16,"slug":17,"title":18,"cleanTitle":18,"numberedTitle":18,"description":19,"path":20,"sourcePath":21,"aliases":22,"basePath":24,"filePath":25,"pageType":26,"hidden":10,"effectiveHidden":10,"order":27,"depth":28,"number":7,"ownAudience":13,"audiences":29,"coverDeLight":7,"coverEnLight":7,"coverDeDark":7,"coverEnDark":7,"children":30},"_info/10_datenschutz","10_datenschutz","Privacy Policy","Information on data protection and the processing of personal data.","/_info/privacy-policy/en","/_info/10_datenschutz/en",["Reactive",23],[21],"/_info/10_datenschutz","content/_Info/10_Datenschutz/en.md","content",10,2,[13],[],{"key":32,"slug":33,"title":34,"cleanTitle":34,"numberedTitle":34,"description":35,"path":36,"sourcePath":37,"aliases":38,"basePath":40,"filePath":41,"pageType":26,"hidden":10,"effectiveHidden":10,"order":42,"depth":28,"number":7,"ownAudience":13,"audiences":43,"coverDeLight":7,"coverEnLight":7,"coverDeDark":7,"coverEnDark":7,"children":44},"_info/11_impressum","11_impressum","Legal Notice","Legal notice for the interactive book.","/_info/legal-notice/en","/_info/11_impressum/en",["Reactive",39],[37],"/_info/11_impressum","content/_Info/11_Impressum/en.md",11,[13],[],{"key":46,"slug":47,"title":48,"cleanTitle":48,"numberedTitle":48,"description":49,"path":50,"sourcePath":51,"aliases":52,"basePath":54,"filePath":55,"pageType":26,"hidden":10,"effectiveHidden":10,"order":56,"depth":28,"number":7,"ownAudience":13,"audiences":57,"coverDeLight":7,"coverEnLight":7,"coverDeDark":7,"coverEnDark":7,"children":58},"_info/12_lizenzenunddrittanbieter","12_lizenzenunddrittanbieter","Licenses & Third-Party Notices","Automatically updated overview of the open-source components, licenses, and third-party notices.","/_info/licenses-and-third-party-notices/en","/_info/12_lizenzenunddrittanbieter/en",["Reactive",53],[51],"/_info/12_lizenzenunddrittanbieter","content/_Info/12_LizenzenUndDrittanbieter/en.md",12,[13],[],{"key":60,"slug":61,"title":62,"cleanTitle":62,"numberedTitle":62,"description":63,"path":64,"sourcePath":65,"aliases":66,"basePath":68,"filePath":69,"pageType":70,"hidden":10,"effectiveHidden":10,"order":71,"depth":28,"number":7,"ownAudience":13,"audiences":72,"coverDeLight":7,"coverEnLight":7,"coverDeDark":7,"coverEnDark":7,"children":73},"_info/13_mailinglisteundnewsletter","13_mailinglisteundnewsletter","Mailing List and Newsletter","Notifications about news and updates","/_info/mailing-list-and-newsletter/en","/_info/13_mailinglisteundnewsletter/en",["Reactive",67],[65],"/_info/13_mailinglisteundnewsletter","content/_Info/13_MailingListeUndNewsLetter/en.md","overview",13,[13],[74,94],{"key":75,"slug":76,"title":77,"cleanTitle":77,"numberedTitle":78,"description":79,"path":80,"sourcePath":81,"aliases":82,"basePath":84,"filePath":85,"pageType":70,"hidden":10,"effectiveHidden":10,"order":11,"depth":86,"number":87,"ownAudience":13,"audiences":88,"coverDeLight":89,"coverEnLight":90,"coverDeDark":91,"coverEnDark":92,"children":93},"_info/13_mailinglisteundnewsletter/newsletter","newsletter","Newsletter","1 Newsletter","Newsletter subscription","/_info/mailing-list-and-newsletter/newsletter/en","/_info/13_mailinglisteundnewsletter/newsletter/en",["Reactive",83],[81],"/_info/13_mailinglisteundnewsletter/newsletter","content/_Info/13_MailingListeUndNewsLetter/newsletter/en.md",3,"1",[13],"cover-de-light.png","cover-en-light.png","cover-de-dark.png","cover-en-dark.png",[],{"key":95,"slug":96,"title":97,"cleanTitle":97,"numberedTitle":98,"description":99,"path":100,"sourcePath":101,"aliases":102,"basePath":104,"filePath":105,"pageType":70,"hidden":10,"effectiveHidden":10,"order":28,"depth":86,"number":106,"ownAudience":13,"audiences":107,"coverDeLight":89,"coverEnLight":90,"coverDeDark":91,"coverEnDark":92,"children":108},"_info/13_mailinglisteundnewsletter/ifk","ifk","Mailing List for Computer Science Teachers in Cologne and the Surrounding Area","2 Mailing List for Computer Science Teachers in Cologne and the Surrounding Area","Discussion and exchange in the wider Cologne region","/_info/mailing-list-and-newsletter/cologne-teachers-mailing-list/en","/_info/13_mailinglisteundnewsletter/ifk/en",["Reactive",103],[101],"/_info/13_mailinglisteundnewsletter/ifk","content/_Info/13_MailingListeUndNewsLetter/ifk/en.md","2",[13],[],{"key":110,"slug":110,"title":111,"cleanTitle":111,"numberedTitle":111,"description":112,"path":113,"sourcePath":113,"aliases":114,"basePath":116,"filePath":117,"pageType":118,"hidden":10,"effectiveHidden":10,"order":-4,"depth":11,"number":7,"ownAudience":7,"audiences":119,"coverDeLight":89,"coverEnLight":90,"coverDeDark":91,"coverEnDark":92,"children":120},"_workshops","Workshops","Workshops and accompanying materials.","/_workshops/en",["Reactive",115],[],"/_workshops","content/_Workshops/en.md","chapter",[],[121],{"key":122,"slug":123,"title":124,"cleanTitle":124,"numberedTitle":125,"description":126,"path":127,"sourcePath":127,"aliases":128,"basePath":130,"filePath":131,"pageType":70,"hidden":10,"effectiveHidden":10,"order":132,"depth":28,"number":87,"ownAudience":7,"audiences":133,"coverDeLight":7,"coverEnLight":7,"coverDeDark":7,"coverEnDark":7,"children":134},"_workshops/2026_09_14","2026_09_14","Informatiktag20260914_AI-Tools","1 Informatiktag20260914_AI-Tools","Subpage for Informatiktag20260914_AI-Tools","/_workshops/2026_09_14/en",["Reactive",129],[],"/_workshops/2026_09_14","content/_Workshops/2026_09_14/en.md",2026,[],[135,150,169,184],{"key":136,"slug":137,"title":138,"cleanTitle":138,"numberedTitle":139,"description":140,"path":141,"sourcePath":142,"aliases":143,"basePath":145,"filePath":146,"pageType":26,"hidden":10,"effectiveHidden":10,"order":-4,"depth":86,"number":147,"ownAudience":7,"audiences":148,"coverDeLight":89,"coverEnLight":90,"coverDeDark":91,"coverEnDark":92,"children":149},"_workshops/2026_09_14/arbeitsauftrag1","arbeitsauftrag1","Task 1","1.1 Task 1","Explore and construct FNN decision regions using Heaviside activations.","/_workshops/2026_09_14/task-1/en","/_workshops/2026_09_14/arbeitsauftrag1/en",["Reactive",144],[142],"/_workshops/2026_09_14/arbeitsauftrag1","content/_Workshops/2026_09_14/arbeitsauftrag1/en.md","1.1",[],[],{"key":151,"slug":152,"title":153,"cleanTitle":153,"numberedTitle":154,"description":155,"path":156,"sourcePath":157,"aliases":158,"basePath":160,"filePath":161,"pageType":26,"hidden":10,"effectiveHidden":10,"order":-4,"depth":86,"number":162,"ownAudience":7,"audiences":163,"coverDeLight":164,"coverEnLight":165,"coverDeDark":166,"coverEnDark":167,"children":168},"_workshops/2026_09_14/arbeitsauftrag2","arbeitsauftrag2","Task 2","1.2 Task 2","Character classification with a Feedforward Neural Network.","/_workshops/2026_09_14/task-2/en","/_workshops/2026_09_14/arbeitsauftrag2/en",["Reactive",159],[157],"/_workshops/2026_09_14/arbeitsauftrag2","content/_Workshops/2026_09_14/arbeitsauftrag2/en.md","1.2",[],"cover-de-light.webp","cover-en-light.webp","cover-de-dark.webp","cover-en-dark.webp",[],{"key":170,"slug":171,"title":172,"cleanTitle":172,"numberedTitle":173,"description":174,"path":175,"sourcePath":176,"aliases":177,"basePath":179,"filePath":180,"pageType":26,"hidden":10,"effectiveHidden":10,"order":-4,"depth":86,"number":181,"ownAudience":7,"audiences":182,"coverDeLight":89,"coverEnLight":90,"coverDeDark":91,"coverEnDark":92,"children":183},"_workshops/2026_09_14/arbeitsauftrag3","arbeitsauftrag3","Task 3","1.3 Task 3","Experimental and mathematical comparison of CCE and MSE in FNN classification.","/_workshops/2026_09_14/task-3/en","/_workshops/2026_09_14/arbeitsauftrag3/en",["Reactive",178],[176],"/_workshops/2026_09_14/arbeitsauftrag3","content/_Workshops/2026_09_14/arbeitsauftrag3/en.md","1.3",[],[],{"key":185,"slug":186,"title":187,"cleanTitle":187,"numberedTitle":188,"description":189,"path":190,"sourcePath":191,"aliases":192,"basePath":194,"filePath":195,"pageType":26,"hidden":10,"effectiveHidden":10,"order":-4,"depth":86,"number":196,"ownAudience":7,"audiences":197,"coverDeLight":89,"coverEnLight":165,"coverDeDark":91,"coverEnDark":167,"children":198},"_workshops/2026_09_14/arbeitsauftrag4","arbeitsauftrag4","Task 4","1.4 Task 4","Two fundamental ideas of RL using bandit problems.","/_workshops/2026_09_14/task-4/en","/_workshops/2026_09_14/arbeitsauftrag4/en",["Reactive",193],[191],"/_workshops/2026_09_14/arbeitsauftrag4","content/_Workshops/2026_09_14/arbeitsauftrag4/en.md","1.4",[],[],{"_path":200,"_dir":201,"_draft":10,"_partial":202,"_locale":7,"title":203,"description":204,"navigation":10,"pageType":26,"pageId":205,"slug":206,"aliases":207,"body":208,"_type":955,"_id":956,"_source":26,"_file":957,"_stem":958,"_extension":959},"/_workshops/2026_09_14/arbeitsauftrag3/loesung-aufgabe-2/en","loesung-aufgabe-2",true,"Solution to Exercise 2","Solution for the mathematical comparison of categorical cross-entropy and MSE.","55586f45-beda-4ede-a6e1-c77c651c0a89","solution-to-exercise-2",[200],{"type":209,"children":210,"toc":943},"root",[211,218,225,238,243,248,252,279,283,304,308,318,324,331,359,363,368,374,390,394,399,403,414,429,433,447,451,456,460,465,471,477,482,489,498,502,512,516,538,542,548,553,557,562,566,576,579,585,590,596,601,605,610,614,619,623,627,631,646,650,656,667,671,676,679,684,688,706,709,714,717,723,756,929,934],{"type":212,"tag":213,"props":214,"children":215},"element","h1",{"id":206},[216],{"type":217,"value":203},"text",{"type":212,"tag":219,"props":220,"children":222},"h2",{"id":221},"a-softmax",[223],{"type":217,"value":224},"a) Softmax",{"type":212,"tag":226,"props":227,"children":228},"p",{},[229,231,236],{"type":217,"value":230},"For ",{"type":212,"tag":232,"props":233,"children":235},"i-ma",{"code":234},"\\mathbf{z}=(0,0,1)",[],{"type":217,"value":237},",",{"type":212,"tag":239,"props":240,"children":242},"d-ma",{"code":241},"\\operatorname{softmax}(0,0,1)\n=\\frac{1}{e^0+e^0+e^1}\n\\begin{pmatrix}\ne^0\\\\\ne^0\\\\\ne^1\n\\end{pmatrix}\n=\\frac{1}{2+e}\n\\begin{pmatrix}\n1\\\\\n1\\\\\ne\n\\end{pmatrix}.",[],{"type":212,"tag":226,"props":244,"children":245},{},[246],{"type":217,"value":247},"Therefore,",{"type":212,"tag":239,"props":249,"children":251},{"code":250},"\\operatorname{softmax}(0,0,1)\n\\approx\n\\begin{pmatrix}\n0.21194\\\\\n0.21194\\\\\n0.57612\n\\end{pmatrix}.",[],{"type":212,"tag":226,"props":253,"children":254},{},[255,257,261,263,267,269,272,274,277],{"type":217,"value":256},"The tool allows logits between ",{"type":212,"tag":232,"props":258,"children":260},{"code":259},"-4",[],{"type":217,"value":262}," and ",{"type":212,"tag":232,"props":264,"children":266},{"code":265},"4",[],{"type":217,"value":268},". With three classes and the Softmax function defined in the exercise without temperature scaling, one component is largest when its logit is ",{"type":212,"tag":232,"props":270,"children":271},{"code":265},[],{"type":217,"value":273}," and the two other logits are both ",{"type":212,"tag":232,"props":275,"children":276},{"code":259},[],{"type":217,"value":278},":",{"type":212,"tag":239,"props":280,"children":282},{"code":281},"p_{\\max}\n=\\frac{e^4}{e^4+2e^{-4}}\n=\\frac{1}{1+2e^{-8}}\n\\approx 0.99933.",[],{"type":212,"tag":226,"props":284,"children":285},{},[286,288,291,293,296,298,302],{"type":217,"value":287},"The component can therefore approach ",{"type":212,"tag":232,"props":289,"children":290},{"code":87},[],{"type":217,"value":292}," very closely but cannot reach ",{"type":212,"tag":232,"props":294,"children":295},{"code":87},[],{"type":217,"value":297}," for finite logits. If the optional temperature mode is enabled at its minimum value ",{"type":212,"tag":232,"props":299,"children":301},{"code":300},"T=0.25",[],{"type":217,"value":303},", the result is even closer:",{"type":212,"tag":239,"props":305,"children":307},{"code":306},"p_{\\max,T=0.25}\n=\\frac{1}{1+2e^{-32}}\n\\approx 0.999999999999975.",[],{"type":212,"tag":226,"props":309,"children":310},{},[311,313,316],{"type":217,"value":312},"Technically, the tool also permits a single neuron. In that case, the sole Softmax value is necessarily ",{"type":212,"tag":232,"props":314,"children":315},{"code":87},[],{"type":217,"value":317},"; however, this trivial case is not multiclass classification.",{"type":212,"tag":219,"props":319,"children":321},{"id":320},"b-comparing-losses-cce-softmax-versus-mse-softmax",[322],{"type":217,"value":323},"b) Comparing losses: CCE + Softmax versus MSE + Softmax",{"type":212,"tag":325,"props":326,"children":328},"h3",{"id":327},"i-cce-with-one-hot-encoding",[329],{"type":217,"value":330},"i) CCE with one-hot encoding",{"type":212,"tag":226,"props":332,"children":333},{},[334,336,340,342,345,347,351,353,357],{"type":217,"value":335},"In single-label classification, the one-hot target vector ",{"type":212,"tag":232,"props":337,"children":339},{"code":338},"\\mathbf{y}",[],{"type":217,"value":341}," has value ",{"type":212,"tag":232,"props":343,"children":344},{"code":87},[],{"type":217,"value":346}," exactly at the position of the correct class ",{"type":212,"tag":232,"props":348,"children":350},{"code":349},"c",[],{"type":217,"value":352},". All other components satisfy ",{"type":212,"tag":232,"props":354,"children":356},{"code":355},"y_i=0",[],{"type":217,"value":358},". Hence every term in the sum except the one for the correct class vanishes:",{"type":212,"tag":239,"props":360,"children":362},{"code":361},"\\begin{aligned}\n\\mathcal{L}_{\\mathrm{CCE}}(\\mathbf{p},\\mathbf{y})\n&=-\\sum_{i=1}^{K}y_i\\ln p_i\\\\\n&=-\\left(0\\ln p_1+\\dots+1\\ln p_c+\\dots+0\\ln p_K\\right)\\\\\n&=-\\ln p_c.\n\\end{aligned}",[],{"type":212,"tag":226,"props":364,"children":365},{},[366],{"type":217,"value":367},"In this case, the CCE loss depends directly on the predicted probability of the correct class.",{"type":212,"tag":325,"props":369,"children":371},{"id":370},"ii-confidently-incorrect-prediction",[372],{"type":217,"value":373},"ii) Confidently incorrect prediction",{"type":212,"tag":226,"props":375,"children":376},{},[377,379,382,384,388],{"type":217,"value":378},"Let ",{"type":212,"tag":232,"props":380,"children":381},{"code":349},[],{"type":217,"value":383}," be the correct class and ",{"type":212,"tag":232,"props":385,"children":387},{"code":386},"r\\ne c",[],{"type":217,"value":389}," an incorrect class. For a maximally confident incorrect prediction,",{"type":212,"tag":239,"props":391,"children":393},{"code":392},"p_c\\to 0,\n\\qquad\np_r\\to 1.",[],{"type":212,"tag":226,"props":395,"children":396},{},[397],{"type":217,"value":398},"For categorical cross-entropy,",{"type":212,"tag":239,"props":400,"children":402},{"code":401},"\\mathcal{L}_{\\mathrm{CCE}}=-\\ln p_c\\to\\infty.",[],{"type":212,"tag":226,"props":404,"children":405},{},[406,408,412],{"type":217,"value":407},"Thus, a confidently incorrect prediction is penalized without bound as the probability of the correct class approaches ",{"type":212,"tag":232,"props":409,"children":411},{"code":410},"0",[],{"type":217,"value":413},".",{"type":212,"tag":226,"props":415,"children":416},{},[417,419,423,424,428],{"type":217,"value":418},"For MSE, the limiting case is ",{"type":212,"tag":232,"props":420,"children":422},{"code":421},"\\mathbf{p}=\\mathbf{e}_r",[],{"type":217,"value":262},{"type":212,"tag":232,"props":425,"children":427},{"code":426},"\\mathbf{y}=\\mathbf{e}_c",[],{"type":217,"value":278},{"type":212,"tag":239,"props":430,"children":432},{"code":431},"\\mathcal{L}_{\\mathrm{MSE}}\n=\\frac{1}{2}\\lVert\\mathbf{e}_r-\\mathbf{e}_c\\rVert_2^2\n=\\frac{1}{2}\\left(1^2+(-1)^2\\right)\n=1.",[],{"type":212,"tag":226,"props":434,"children":435},{},[436,438,441,442,445],{"type":217,"value":437},"The MSE loss therefore remains bounded. With the tool's logit limits of ",{"type":212,"tag":232,"props":439,"children":440},{"code":259},[],{"type":217,"value":262},{"type":212,"tag":232,"props":443,"children":444},{"code":265},[],{"type":217,"value":446}," and three classes, for example,",{"type":212,"tag":239,"props":448,"children":450},{"code":449},"p_c=0.000335,\n\\qquad\np_r=0.999330,",[],{"type":212,"tag":226,"props":452,"children":453},{},[454],{"type":217,"value":455},"which gives",{"type":212,"tag":239,"props":457,"children":459},{"code":458},"\\mathcal{L}_{\\mathrm{CCE}}\\approx 8.00067,\n\\qquad\n\\mathcal{L}_{\\mathrm{MSE}}\\approx 0.998995.",[],{"type":212,"tag":226,"props":461,"children":462},{},[463],{"type":217,"value":464},"As in the exercise, the natural logarithm is used for cross-entropy here.",{"type":212,"tag":219,"props":466,"children":468},{"id":467},"c-comparing-error-signals-cce-softmax-versus-mse-softmax",[469],{"type":217,"value":470},"c) Comparing error signals: CCE + Softmax versus MSE + Softmax",{"type":212,"tag":325,"props":472,"children":474},{"id":473},"i-total-loss-as-a-function-of-the-logits",[475],{"type":217,"value":476},"i) Total loss as a function of the logits",{"type":212,"tag":226,"props":478,"children":479},{},[480],{"type":217,"value":481},"The formula can be derived in two ways.",{"type":212,"tag":483,"props":484,"children":486},"h4",{"id":485},"solution-1-simplified-form-for-single-label-classification",[487],{"type":217,"value":488},"Solution 1: Simplified form for single-label classification",{"type":212,"tag":226,"props":490,"children":491},{},[492,494,497],{"type":217,"value":493},"For the correct class ",{"type":212,"tag":232,"props":495,"children":496},{"code":349},[],{"type":217,"value":237},{"type":212,"tag":239,"props":499,"children":501},{"code":500},"p_c=\\frac{e^{z_c}}{\\sum_{j=1}^{K}e^{z_j}}.",[],{"type":212,"tag":226,"props":503,"children":504},{},[505,507,511],{"type":217,"value":506},"Substitute this into the simplified form ",{"type":212,"tag":232,"props":508,"children":510},{"code":509},"\\mathcal{L}_{\\mathrm{CCE}}(\\mathbf{p},\\mathbf{y})=-\\ln p_c",[],{"type":217,"value":278},{"type":212,"tag":239,"props":513,"children":515},{"code":514},"\\begin{aligned}\n\\mathcal{L}(\\mathbf{z},\\mathbf{y})\n&=-\\ln\\left(\\frac{e^{z_c}}{\\sum_{j=1}^{K}e^{z_j}}\\right)\\\\\n&=-\\left(z_c-\\ln\\left(\\sum_{j=1}^{K}e^{z_j}\\right)\\right)\\\\\n&=-z_c+\\ln\\left(\\sum_{j=1}^{K}e^{z_j}\\right).\n\\end{aligned}",[],{"type":212,"tag":226,"props":517,"children":518},{},[519,521,524,526,530,532,536],{"type":217,"value":520},"Since ",{"type":212,"tag":232,"props":522,"children":523},{"code":338},[],{"type":217,"value":525}," is a one-hot target vector with ",{"type":212,"tag":232,"props":527,"children":529},{"code":528},"y_c=1",[],{"type":217,"value":531},", ",{"type":212,"tag":232,"props":533,"children":535},{"code":534},"z_c=\\sum_{k=1}^{K}y_kz_k",[],{"type":217,"value":537},". Therefore,",{"type":212,"tag":239,"props":539,"children":541},{"code":540},"\\boxed{\n\\mathcal{L}(\\mathbf{z},\\mathbf{y})\n=-\\sum_{k=1}^{K}y_kz_k\n+\\ln\\left(\\sum_{j=1}^{K}e^{z_j}\\right)\n}.",[],{"type":212,"tag":483,"props":543,"children":545},{"id":544},"solution-2-general-categorical-cross-entropy-form",[546],{"type":217,"value":547},"Solution 2: General categorical cross-entropy form",{"type":212,"tag":226,"props":549,"children":550},{},[551],{"type":217,"value":552},"Substitute",{"type":212,"tag":239,"props":554,"children":556},{"code":555},"p_k=\\frac{e^{z_k}}{\\sum_{j=1}^{K}e^{z_j}}",[],{"type":212,"tag":226,"props":558,"children":559},{},[560],{"type":217,"value":561},"into the general categorical cross-entropy formula:",{"type":212,"tag":239,"props":563,"children":565},{"code":564},"\\begin{aligned}\n\\mathcal{L}(\\mathbf{z},\\mathbf{y})\n&=-\\sum_{k=1}^{K}y_k\n\\ln\\left(\\frac{e^{z_k}}{\\sum_{j=1}^{K}e^{z_j}}\\right)\\\\\n&=-\\sum_{k=1}^{K}y_k\n\\left(z_k-\\ln\\left(\\sum_{j=1}^{K}e^{z_j}\\right)\\right)\\\\\n&=-\\sum_{k=1}^{K}\n\\left(y_kz_k-y_k\\ln\\left(\\sum_{j=1}^{K}e^{z_j}\\right)\\right)\\\\\n&=-\\sum_{k=1}^{K}y_kz_k\n+\\sum_{k=1}^{K}y_k\\ln\\left(\\sum_{j=1}^{K}e^{z_j}\\right)\\\\\n&=-\\sum_{k=1}^{K}y_kz_k\n+\\ln\\left(\\sum_{j=1}^{K}e^{z_j}\\right)\n\\underbrace{\\sum_{k=1}^{K}y_k}_{=1}.\n\\end{aligned}",[],{"type":212,"tag":226,"props":567,"children":568},{},[569,571,575],{"type":217,"value":570},"Since a one-hot target vector satisfies ",{"type":212,"tag":232,"props":572,"children":574},{"code":573},"\\sum_{k=1}^{K}y_k=1",[],{"type":217,"value":237},{"type":212,"tag":239,"props":577,"children":578},{"code":540},[],{"type":212,"tag":325,"props":580,"children":582},{"id":581},"ii-gradient-of-the-loss",[583],{"type":217,"value":584},"ii) Gradient of the loss",{"type":212,"tag":226,"props":586,"children":587},{},[588],{"type":217,"value":589},"The gradient can likewise be derived from either form.",{"type":212,"tag":483,"props":591,"children":593},{"id":592},"solution-1-simplified-form-for-one-hot-encoded-targets",[594],{"type":217,"value":595},"Solution 1: Simplified form for one-hot encoded targets",{"type":212,"tag":226,"props":597,"children":598},{},[599],{"type":217,"value":600},"Start from",{"type":212,"tag":239,"props":602,"children":604},{"code":603},"\\mathcal{L}(\\mathbf{z},\\mathbf{y})\n=-z_c+\\ln\\left(\\sum_{j=1}^{K}e^{z_j}\\right).",[],{"type":212,"tag":226,"props":606,"children":607},{},[608],{"type":217,"value":609},"For the derivative of the first term,",{"type":212,"tag":239,"props":611,"children":613},{"code":612},"\\frac{\\partial(-z_c)}{\\partial z_i}\n=\n\\begin{cases}\n-1,& i=c,\\\\\n0,& i\\ne c.\n\\end{cases}",[],{"type":212,"tag":226,"props":615,"children":616},{},[617],{"type":217,"value":618},"The second term gives",{"type":212,"tag":239,"props":620,"children":622},{"code":621},"\\begin{aligned}\n\\frac{\\partial}{\\partial z_i}\n\\ln\\left(\\sum_{j=1}^{K}e^{z_j}\\right)\n&=\\frac{1}{\\sum_{j=1}^{K}e^{z_j}}\\cdot e^{z_i}\\\\\n&=p_i.\n\\end{aligned}",[],{"type":212,"tag":226,"props":624,"children":625},{},[626],{"type":217,"value":247},{"type":212,"tag":239,"props":628,"children":630},{"code":629},"\\frac{\\partial\\mathcal{L}}{\\partial z_i}\n=\n\\begin{cases}\np_c-1,& i=c,\\\\\np_i,& i\\ne c.\n\\end{cases}",[],{"type":212,"tag":226,"props":632,"children":633},{},[634,635,638,640,644],{"type":217,"value":520},{"type":212,"tag":232,"props":636,"children":637},{"code":338},[],{"type":217,"value":639}," is a one-hot target vector, this is ",{"type":212,"tag":232,"props":641,"children":643},{"code":642},"p_i-y_i",[],{"type":217,"value":645}," componentwise. In vector form,",{"type":212,"tag":239,"props":647,"children":649},{"code":648},"\\boxed{\n\\nabla_{\\mathbf{z}}\\mathcal{L}(\\mathbf{z},\\mathbf{y})\n=\\mathbf{p}-\\mathbf{y}\n}.",[],{"type":212,"tag":483,"props":651,"children":653},{"id":652},"solution-2-more-general-form",[654],{"type":217,"value":655},"Solution 2: More general form",{"type":212,"tag":226,"props":657,"children":658},{},[659,661,665],{"type":217,"value":660},"For any component ",{"type":212,"tag":232,"props":662,"children":664},{"code":663},"z_i",[],{"type":217,"value":666},", differentiate the two terms separately:",{"type":212,"tag":239,"props":668,"children":670},{"code":669},"\\frac{\\partial}{\\partial z_i}\n\\left(-\\sum_{k=1}^{K}y_kz_k\\right)\n=-y_i",[],{"type":212,"tag":226,"props":672,"children":673},{},[674],{"type":217,"value":675},"and",{"type":212,"tag":239,"props":677,"children":678},{"code":621},[],{"type":212,"tag":226,"props":680,"children":681},{},[682],{"type":217,"value":683},"Thus, componentwise,",{"type":212,"tag":239,"props":685,"children":687},{"code":686},"\\frac{\\partial\\mathcal{L}}{\\partial z_i}=p_i-y_i.",[],{"type":212,"tag":226,"props":689,"children":690},{},[691,692,696,697,700,702,705],{"type":217,"value":493},{"type":212,"tag":232,"props":693,"children":695},{"code":694},"i=c",[],{"type":217,"value":531},{"type":212,"tag":232,"props":698,"children":699},{"code":528},[],{"type":217,"value":701},"; for all other classes, ",{"type":212,"tag":232,"props":703,"children":704},{"code":355},[],{"type":217,"value":537},{"type":212,"tag":239,"props":707,"children":708},{"code":629},[],{"type":212,"tag":226,"props":710,"children":711},{},[712],{"type":217,"value":713},"In vector form,",{"type":212,"tag":239,"props":715,"children":716},{"code":648},[],{"type":212,"tag":325,"props":718,"children":720},{"id":719},"iii-examining-the-error-signals",[721],{"type":217,"value":722},"iii) Examining the error signals",{"type":212,"tag":226,"props":724,"children":725},{},[726,727,730,731,734,736,740,742,746,747,750,751,755],{"type":217,"value":493},{"type":212,"tag":232,"props":728,"children":729},{"code":349},[],{"type":217,"value":531},{"type":212,"tag":232,"props":732,"children":733},{"code":528},[],{"type":217,"value":735}," and therefore ",{"type":212,"tag":232,"props":737,"children":739},{"code":738},"\\frac{\\partial\\mathcal{L}}{\\partial z_c}=p_c-1",[],{"type":217,"value":741},". For an incorrect class ",{"type":212,"tag":232,"props":743,"children":745},{"code":744},"i\\ne c",[],{"type":217,"value":531},{"type":212,"tag":232,"props":748,"children":749},{"code":355},[],{"type":217,"value":735},{"type":212,"tag":232,"props":752,"children":754},{"code":753},"\\frac{\\partial\\mathcal{L}}{\\partial z_i}=p_i",[],{"type":217,"value":413},{"type":212,"tag":757,"props":758,"children":759},"table",{},[760,799],{"type":212,"tag":761,"props":762,"children":763},"thead",{},[764],{"type":212,"tag":765,"props":766,"children":767},"tr",{},[768,774,787,794],{"type":212,"tag":769,"props":770,"children":771},"th",{},[772],{"type":217,"value":773},"Case",{"type":212,"tag":769,"props":775,"children":776},{},[777,779,782,783],{"type":217,"value":778},"Example for ",{"type":212,"tag":232,"props":780,"children":781},{"code":338},[],{"type":217,"value":262},{"type":212,"tag":232,"props":784,"children":786},{"code":785},"\\mathbf{p}",[],{"type":212,"tag":769,"props":788,"children":789},{},[790],{"type":212,"tag":232,"props":791,"children":793},{"code":792},"\\mathbf{p}-\\mathbf{y}",[],{"type":212,"tag":769,"props":795,"children":796},{},[797],{"type":217,"value":798},"Meaning",{"type":212,"tag":800,"props":801,"children":802},"tbody",{},[803,836,867,898],{"type":212,"tag":765,"props":804,"children":805},{},[806,812,824,831],{"type":212,"tag":807,"props":808,"children":809},"td",{},[810],{"type":217,"value":811},"confidently correct",{"type":212,"tag":807,"props":813,"children":814},{},[815,819,820],{"type":212,"tag":232,"props":816,"children":818},{"code":817},"\\mathbf{y}=(1,0,0)",[],{"type":217,"value":531},{"type":212,"tag":232,"props":821,"children":823},{"code":822},"\\mathbf{p}\\approx(1,0,0)",[],{"type":212,"tag":807,"props":825,"children":826},{},[827],{"type":212,"tag":232,"props":828,"children":830},{"code":829},"\\approx(0,0,0)",[],{"type":212,"tag":807,"props":832,"children":833},{},[834],{"type":217,"value":835},"Almost no correction is required.",{"type":212,"tag":765,"props":837,"children":838},{},[839,844,855,862],{"type":212,"tag":807,"props":840,"children":841},{},[842],{"type":217,"value":843},"confidently incorrect",{"type":212,"tag":807,"props":845,"children":846},{},[847,850,851],{"type":212,"tag":232,"props":848,"children":849},{"code":817},[],{"type":217,"value":531},{"type":212,"tag":232,"props":852,"children":854},{"code":853},"\\mathbf{p}\\approx(0,1,0)",[],{"type":212,"tag":807,"props":856,"children":857},{},[858],{"type":212,"tag":232,"props":859,"children":861},{"code":860},"\\approx(-1,1,0)",[],{"type":212,"tag":807,"props":863,"children":864},{},[865],{"type":217,"value":866},"The logit of the correct class is raised strongly, while that of the incorrectly selected class is lowered strongly.",{"type":212,"tag":765,"props":868,"children":869},{},[870,875,886,893],{"type":212,"tag":807,"props":871,"children":872},{},[873],{"type":217,"value":874},"uncertain but correct",{"type":212,"tag":807,"props":876,"children":877},{},[878,881,882],{"type":212,"tag":232,"props":879,"children":880},{"code":817},[],{"type":217,"value":531},{"type":212,"tag":232,"props":883,"children":885},{"code":884},"\\mathbf{p}=(0.40,0.35,0.25)",[],{"type":212,"tag":807,"props":887,"children":888},{},[889],{"type":212,"tag":232,"props":890,"children":892},{"code":891},"(-0.60,0.35,0.25)",[],{"type":212,"tag":807,"props":894,"children":895},{},[896],{"type":217,"value":897},"The correct class wins narrowly; the error signal is still substantial.",{"type":212,"tag":765,"props":899,"children":900},{},[901,906,917,924],{"type":212,"tag":807,"props":902,"children":903},{},[904],{"type":217,"value":905},"uncertain and incorrect",{"type":212,"tag":807,"props":907,"children":908},{},[909,912,913],{"type":212,"tag":232,"props":910,"children":911},{"code":817},[],{"type":217,"value":531},{"type":212,"tag":232,"props":914,"children":916},{"code":915},"\\mathbf{p}=(0.35,0.40,0.25)",[],{"type":212,"tag":807,"props":918,"children":919},{},[920],{"type":212,"tag":232,"props":921,"children":923},{"code":922},"(-0.65,0.40,0.25)",[],{"type":212,"tag":807,"props":925,"children":926},{},[927],{"type":217,"value":928},"The incorrect class wins narrowly; the correction has the same direction but is weaker than for a confidently incorrect prediction.",{"type":212,"tag":226,"props":930,"children":931},{},[932],{"type":217,"value":933},"The signs have a clear effect under gradient descent: a negative entry raises the corresponding logit, while a positive entry lowers it. This increases the probability of the correct class and decreases those of the incorrect classes.",{"type":212,"tag":226,"props":935,"children":936},{},[937],{"type":212,"tag":938,"props":939,"children":940},"a",{"href":176},[941],{"type":217,"value":942},"Back to Task 3",{"title":7,"searchDepth":28,"depth":28,"links":944},[945,946,950],{"id":221,"depth":28,"text":224},{"id":320,"depth":28,"text":323,"children":947},[948,949],{"id":327,"depth":86,"text":330},{"id":370,"depth":86,"text":373},{"id":467,"depth":28,"text":470,"children":951},[952,953,954],{"id":473,"depth":86,"text":476},{"id":581,"depth":86,"text":584},{"id":719,"depth":86,"text":722},"markdown","content:_Workshops:2026_09_14:arbeitsauftrag3:loesung-aufgabe-2:en.md","_Workshops/2026_09_14/arbeitsauftrag3/loesung-aufgabe-2/en.md","_Workshops/2026_09_14/arbeitsauftrag3/loesung-aufgabe-2/en","md",1793367297161]