---
title: QR DQN
tags: DQN
---
C51의 후속 논문으로 sampling으로 target distribution으로 구해서 Wasserstein metric을 구하게 되면, bias 문제가 발생한다.
$$\arg\min\mathbb{E}[W_p(\hat Z_m, Z_\theta)] \neq \arg\min W_p(Z,Z_\theta)$$
논문에서는 이를 해결하기 위해 우선 C51처럼 고정된 support 위에서의 확률분포를 예측하는 것 대신, support를 예측하고 확률을 동일하게 나눈다.

만약 확률이 높은 support값이 있다면 그 주변에 support가 밀집되어 있을 것이다.

p-Wasserstein metric은 분포 간의 support 차이의 크기를 모두 더해서 similarity를 구한다. 논문에서 사용하는 quantile regression도 이와 마찬가지로 support 간의 차이를 minimize하기 때문에 결과적으로 p-wasserstein metric이 줄어든다고 볼 수 있다. 다만 차이가 있다면 overestimatation error에는 $\tau$를 곱하고, underestimation error는 $1-\tau$를 곱해주어 패널티를 준다.
**p-Wasserstein**
$$W_p(U,Y)= \left( \int^1_0 |F^{-1}_Y(\omega) - F^{-1}_U(\omega)\mid^p d\omega \right)^{1/p}$$
* $U$, $Y$ : 임의의 distribution
* $F$ : cumulative distribution functions
**quantile regression**
$$ \mathcal{L}^{\tau}_{QR}(\theta) := \mathbb{E}_{\hat Z \sim Z} [\rho_\tau(\mathcal{T}\theta - \theta(x,a)], \\ \text{where } \rho_\tau(u) = u(\tau-1_{\{u<0\}}), \forall u \in \mathbb{R} $$
- $\mathcal{T}$ : Bellman Operator
- $\theta$ : support

**unbiased sample gradient**
기존의 C51은 sample의 bias로 인해 wasserstein metric을 사용하지 못하고 KL divergence를 사용했다. 그래서 이 bias를 해결하는 방법을 support midpoint로 해결한다. 임의의 $\tau$, $\tau'$ 사이에서 approximation error를 가장 최소화할 수 있는 위치가 중간 지점인 $\hat \tau$이기 때문이다.

**Huber Quantile regression**
Quantile regression은 0인 부분에서 smooth하지 못하기 때문에 convergence 하기 쉽지 않다. 따라서 Huber loss와 결합해 smoothing 한다.
$$
\mathcal{L}_{\kappa}(u) =
\begin{cases}
\frac{1}{2}u^2, & \mbox{if }|u| \le \kappa \\
\kappa(|u|-\frac{1}{2}\kappa), & \mbox{otherwise }
\end{cases}
$$

---