\begin{array}{c}
w_{d} = \log \left(\frac{\sum_{d^{\prime} = 1}^{\mathcal{D}} \sum_{h = 1}^{\mathcal{H}} d_{i s t}\left(x_{h}^{d^{\prime}}, x_{h}^{*}\right)}{\sum_{h = 1}^{\mathcal{H}} d_{i s t}\left(x_{h}^{d}, x_{h}^{*}\right)}\right)
\end{array}
\begin{eqnarray}
w_{d} & = & \log \left(\frac{\sum_{d^{\prime} & = & 1}^{\mathcal{D}} \sum_{h & = & 1}^{\mathcal{H}} d_{i s t}\left(x_{h}^{d^{\prime}}, x_{h}^{*}\right)}{\sum_{h & = & 1}^{\mathcal{H}} d_{i s t}\left(x_{h}^{d}, x_{h}^{*}\right)}\right)
\end{eqnarray}