# Why does the equation $-\sum^{n}_{t=1} \tilde{W}(t)_{m-1} y_{t}h(x; \theta_{m}) = 2 \epsilon_m -1$ hold in boosting?

I was trying to understand the boosting algorithm as described by the MIT graduate class lectures notes on ocw.

On page 2 they give the outline of boosting as follows:

The step that is not clear to me is the relation marked as equation (2). i.e.

$$-\sum^{n}_{t=1} \tilde{W}(t)_{m-1} y_{t}h(x; \theta_{m}) = 2 \epsilon_m -1$$

Why does that relation hold? It is not entirely clear to me.

Also, recall that $\epsilon_m$ is the weighted classification error (zero-one loss). i.e.

$$\epsilon_m = \sum^{n}_{t=1} \tilde{W} (t) _{m-1} \mathbb{1}\{ y^{(t)} \neq h(x^{(t)}; \theta_{m})\}$$

where $\mathbb{1}\{ \cdot \}$ is the indicator function.

$$1 = 2 \epsilon_m + \sum_{t=1}^n W_{m-1}(t) y_t h(x_t, \theta) = \sum_{t=1}^n W_{m-1}(t) \Bigl(2 [h(x_t, \theta) \ne y_t] + y_t h(x_t, \theta) \Bigr)$$
Now, let's look at what we have in the big parenthesis. Remember that $h(x), y \in \{-1, +1\}$, so if they match, then the bracket is equal to 1. If they don't match the bracket is also equal to 2 - 1 = 1. Thus the whole things sums to 1, since Ws are normalized.