lass="dv">1</span> +<span class="st"> </span><span class="kw">exp</span>(-<span class="st"> </span>beta0_j -<span class="st"> </span><span class="kw">sum</span>(XTest[i,] *<span class="st"> </span>beta_j)))
        y_i =<span class="st"> </span>yTest[i]
        <span class="co"># Calculate log loss at current test set point</span>
        LogPred_curr =<span class="st"> </span>-<span class="st"> </span>(y_i *<span class="st"> </span><span class="kw">log</span>(pihat_ij) +<span class="st"> </span>(<span clas