I'm trying to replicate the style of the following pseudocode taken from 'The Elements of Statistical Learning'.

I've tried with algorithm,algorithmic and enumerate (for the item) but I haven't reached the result below...



This is just a nested enumerate inside an algorithm environment:

enter image description here


\captionsetup[algorithm]{labelfont={bf,lightblue}, textfont={it}}


\setcounter{chapter}{10}% Just for this example

    Initialize the observation weights $w_i = 1/N$, $i = 1, 2, \dots, N$

    For $m = 1$ to $M$:
      Fit a classifier $G_m(x)$ to the training data using weights $w_i$.

        \text{err}_m = \frac{\sum_{i=1}^N w_i I(y_i \neq G_m(x_i))}{\sum_{i=1}^N w_i}.

      Compute $\alpha_m = \log((1 - \text{err}_m) / \text{err}_m)$.

      Set $w_i \leftarrow w_i \cdot \exp [\alpha_m \cdot I(y_i \neq G_m(x_i))]$, $i = 1, 2, \dots, N$.

  Output $G(x) = \sgn \bigl[ \sum_{m = 1}^M \alpha_m G_m(x) \bigr]$.


|improve this answer|||||
  • this looks really neat to me – Jinhua Wang Aug 31 '19 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.