\section{Introduction}

	Existing machine learning methods, particularly deep learning models, typically require big data to pursue remarkable performances. For instance, conditional deep generative models are able to generate high-fidelity and diverse images, but they have to rely on vast amounts of labeled data~\cite{lucic2019high}. Nevertheless, it is often laborious or impractical to collect large-scale accurate class-labeled data in real-world scenarios, and thus the label scarcity is ubiquitous. Under such circumstances, the performance of classification and conditional generation~\cite{mirza2014conditional} drops significantly~\cite{lucic2019high}. At the same time, diverse unlabeled data are available in enormous quantities, and therefore a key issue is how to take advantage of the extra data to enhance the conditional generation or classification.

	Within the unlabeled data, both in-distribution and out-of-distribution data exist, where in-distribution data conform to the distribution of the labeled data while out-of-distribution data do not. Our key insight is to harness the out-of-distribution data. In generation with extra data, most related works focus on the in-distribution data~\cite{lucic2019high,gui2020review,donahue2019large}. When it comes to the out-of-distribution data, the majority of existing methods~\cite{noguchi2019image, yamaguchi2019effective,zhao2020leveraging}  attempt to forcibly train generative models on a large number of unlabeled data, and then transfer the learned knowledge of the pre-trained generator to the in-distribution data. In classification, a common setting to utilize unlabeled data is semi-supervised learning~\cite{miyato2018virtual, sun2019patch, berthelot2019mixmatch}, which usually assumes that the unlabeled and labeled data come from the same distribution, ignoring their distributional mismatch. In contrast, Positive and Unlabeled~(PU) Learning~\cite{bekker2018learning, kiryo2017positive} is an elegant way of handling this under-studied problem, where a model only has access to positive examples and unlabeled data. Therefore, it is possible to utilize pseudo labels predicted by a PU classifier on unlabeled data to guide the conditional generation. However, the predicted signals from the classifier tend to be noisy. Although there are a flurry of papers related to learning from noisy labels for classification~\cite{tasi2019noise,ge2020mutual,guo2019learning}, to our best knowledge, no work has considered to leverage the noisy labels seamlessly in joint classification and generation. The discussion about more related works can refer to Appendix~\ref{relatedworks}.

	In this paper, we focus on the mutual benefits of conditional generation and PU classification, in settings where although little class-labeled data is available, extra unlabeled data, including out-of-distribution data, are provided. Firstly, a parallel non-negative multi-class PU estimator is derived to classify both the positive data of all classes and the negative data. Then we design a Classifier-Noise-Invariant Conditional Generative Adversarial Network~(CNI-CGAN) that is able to learn the clean data distribution on all unlabeled data with noisy labels provided by the PU classifier. Conversely, we also leverage our CNI-CGAN to enhance the performance of the PU classification through data augmentation, demonstrating a reciprocal benefit for both generation and classification. We provide the theoretical analysis on the optimal condition of our CNI-CGAN and conduct extensive experiments to verify the superiority of our approach. To our best knowledge, we are the first to leverage the interplay between generative models and PU classifiers for mutual improvements.

	\section{Our Method}

	\subsection{Positive-Unlabeled Learning}\label{sec:PU}

	\textbf{Traditional Binary Positive-Unlabeled Problem Setting} Let $X\in\mathbb{R}^d$ and $Y\in\{\pm1\}$ be the input and output variables and $p(x, y)$ is the joint distribution with marginal distribution $p_p(x)=p(x|Y=+1)$ and $p_n(x)=p(x|Y=-1)$. In particular, we denote $p(x)$ as the distribution of unlabeled data. $n_p$, $n_n$ and $n_u$ are the amount of positive, negative and unlabeled data, respectively.

	\textbf{Parallel Non-Negative PU Estimator} Vanilla PU learning~\cite{bekker2018learning, kiryo2017positive} employs unbiased and consistent estimator. Denote $g_{\theta}: \mathbb{R}^{d} \rightarrow \mathbb{R}$ as the score function parameterized by $\theta$, and $\ell: \mathbb{R} \times\{\pm 1\} \rightarrow \mathbb{R}$ as the loss function. The risk of $g_\theta$ can be approximated by its empirical version denoted as $\widehat{R}_{\mathrm{pn}}(g_\theta)$:
	\begin{equation} \begin{aligned}
	\widehat{R}_{\mathrm{pn}}(g_\theta)=\pi_{\mathrm{p}} \widehat{R}_{\mathrm{p}}^{+}(g_\theta)+\pi_{\mathrm{n}} \widehat{R}_{\mathrm{n}}^{-}(g_\theta),
	\end{aligned} \end{equation}
	where $\pi_p$ represents the class prior probability, i.e. $P(Y=+1)$, with $\pi_p+\pi_n=1$, and $\widehat{R}_{\mathrm{p}}^{+}(g_\theta)=\frac{1}{n_p} \sum_{i=1}^{n_{\mathrm{p}}} \ell\left(g_\theta \left(x_{i}^{\mathrm{p}}\right),+1\right)$ and $\widehat{R}_{\mathrm{n}}^{-}(g_\theta)=\frac{1}{n_n} \sum_{i=1}^{n_{\mathrm{n}}} \ell\left(g_\theta \left(x_{i}^{\mathrm{n}}\right),-1\right)$. As negative data $x^n$ are unavailable, a common strategy is to offset $R_{\mathrm{n}}^{-}(g_\theta)$. We also know that $\pi_{\mathrm{n}} p_{\mathrm{n}}(x)=p(x)-\pi_{\mathrm{p}} p_{\mathrm{p}}(x)$, and hence $\pi_{\mathrm{n}} \widehat{R}_{\mathrm{n}}^{-}(g_\theta)=\widehat{R}_{\mathrm{u}}^{-}(g_\theta)-\pi_{\mathrm{p}} \widehat{R}_{\mathrm{p}}^{-}(g_\theta)$. Then the resulting unbiased risk estimator $	\widehat{R}_{\mathrm{pu}}(g_\theta)$ can be formulated as:
	\begin{equation} \begin{aligned}
	\widehat{R}_{\mathrm{pu}}(g_\theta)=\pi_{\mathrm{p}} \widehat{R}_{\mathrm{p}}^{+}(g_\theta)-\pi_{\mathrm{p}} \widehat{R}_{\mathrm{p}}^{-}(g_\theta)+\widehat{R}_{\mathrm{u}}^{-}(g_\theta),
	\end{aligned} \end{equation}
	where $\widehat{R}_{\mathrm{p}}^{-}(g_\theta)=\frac{1}{n_p} \sum_{i=1}^{n_{\mathrm{p}}} \ell\left(g_\theta \left(x_{i}^{\mathrm{p}}\right),-1\right)$ and $\widehat{R}_{\mathrm{u}}^{-}(g_\theta)=\frac{1}{n_u} \sum_{i=1}^{n_{\mathrm{u}}} \ell\left(g_\theta \left(x_{i}^{\mathrm{u}}\right),-1\right)$. The advantage of this unbiased risk minimizer is that the optimal solution can be easily obtained if $g$ is linear in $\theta$. However, in real scenarios we tend to leverage more flexible models $g_\theta$, e.g., deep neural networks. This strategy will push the estimator to a point where it starts to suffer from overfitting. Hence, we decide to utilize \textit{non-negative risk}~\cite{kiryo2017positive} for our PU learning, which has been verified in \cite{kiryo2017positive} to allow deep neural network to mitigate overfitting. The non-negative PU estimator is formulated as:
	\begin{equation} \begin{aligned}
	\widehat{R}_{\mathrm{pu}}(g_\theta)=\pi_{\mathrm{p}} \widehat{R}_{\mathrm{p}}^{+}(g_\theta)+\max \left\{0, \widehat{R}_{\mathrm{u}}^{-}(g_\theta)-\pi_{\mathrm{p}} \widehat{R}_{\mathrm{p}}^{-}(g_\theta)\right\}.
	\end{aligned} \end{equation}
	In pursue of the parallel implementation of $\widehat{R}_{\mathrm{pu}}(g_\theta)$, we replace $\max \left\{0, \widehat{R}_{\mathrm{u}}^{-}(g_\theta)-\pi_{\mathrm{p}} \widehat{R}_{\mathrm{p}}^{-}(g_\theta)\right\}$ with its lower bound $\frac{1}{N}\sum_{i=1}^{N}\max \left\{0, \widehat{R}_{\mathrm{u}}^{-}(g_\theta; \mathcal{X}^i_u)-\pi_{\mathrm{p}} \widehat{R}_{\mathrm{p}}^{-}(g_\theta; \mathcal{X}^i_p)\right\}$ where $\mathcal{X}^i_u$ and $\mathcal{X}^i_p$ denote as the unlabeled and positive data in the $i$-th mini-batch. $N$ is the number of batches.

	\textbf{From Binary PU to Multi-PU Learning} Previous PU learning  focuses on learning a classifier from positive and unlabeled data, and cannot easily be adapted to $K+1$ multi-classification tasks where $K$ represents the number of classes in the positive data. Xu et al.~\cite{xu2017multi} ever developed Multi-Positive and Unlabeled learning, but the proposed algorithm has not necessarily allowed deep neural networks. Instead, we extend binary PU  learning to multi-class version in a straightforward way by additionally incorporating cross entropy loss on all the positive data with labels for different classes. More precisely, we consider the $K+1$-class classifier $f_\theta$  as a score function $f_{\theta} = \left(f_{\theta}^{1}(x), \ldots, f_{\theta}^{K+1}(x)\right)$. After the \textit{softmax} function, we select the first $K$ positive data to construct cross-entropy loss $\ell^{\mathrm{CE}}$, i.e., $\ell^{\mathrm{CE}}(f_\theta(x), y)=\log \sum_{j=1}^{K+1} \exp \left(f_{\theta}^{j}(x)\right)-f_{\theta}^{y}(x)$ where $y\in [K]$. For the PU loss, we consider the composite function $h(f_\theta(x)): \mathbb{R}^{d} \rightarrow \mathbb{R}$ where $h(\cdot)$ conduct a logit transformation on the accumulative probability for the first $K$ classes, i.e., $h(f_\theta(x))=\text{ln}(\frac{p}{1-p})$ where $p=\sum_{j=1}^{K} \exp \left(f_{\theta}^{j}(x)\right) / \sum_{j=1}^{K+1} \exp \left(f_{\theta}^{j}(x)\right)$. The final mini-batch risk of our PU learning can be presented as:
	\begin{equation} \begin{aligned}\label{eq:PU}
	\widetilde{R}_{\mathrm{pu}}(f_\theta; \mathcal{X}^i) = \pi_{\mathrm{p}} \widehat{R}_{\mathrm{p}}^{+}(h(f_\theta); \mathcal{X}^i_p) +  \max \left\{0, \widehat{R}_{\mathrm{u}}^{-}(h(f_\theta); \mathcal{X}^i_u)-\pi_{\mathrm{p}} \widehat{R}_{\mathrm{p}}^{-}(h(f_\theta); \mathcal{X}^i_p)\right\}
	+ \widehat{R}_{\mathrm{p}}^{\mathrm{CE}}(f_\theta; \mathcal{X}^i_p),
	\end{aligned} \end{equation}
	where $\widehat{R}_{\mathrm{p}}^{\mathrm{CE}}(f_\theta; \mathcal{X}^i_p)=\frac{1}{n_p} \sum_{i=1}^{n_{\mathrm{p}}} \ell^{\mathrm{CE}} \left(f_\theta \left(x_{i}^{\mathrm{p}}\right),y\right)$.

	\subsection{Classifier-Noise-Invariant Conditional Generative Adversarial Network}\label{sec:CNI-CGAN}

	\begin{figure}[b!]
		\centering
		\includegraphics[width=0.5\textwidth,trim=210 150 250 105,clip]{1Architecture.pdf}
		\caption{Model architecture of our Classifier-Noise-Invariant Conditional GAN~(CNI-CGAN). The output $x_g$ of the conditional generator $G$ is paired with a noisy label $\tilde{y}$ corrupted by the PU-dependent confusion matrix $\tilde{C}$. The discriminator $D$ distinguishes between whether a given labeled sample comes from the real data $(x_r, PU_{\theta}(x_r))$ or generated data $(x_g, \tilde{y})$.}
		\label{fig:architecture}
	\end{figure}

	To leverage extra data, i.e., all unlabeled data, to benefit the generation, we deploy our conditional generative model on all data with pseudo labels predicted by our pre-trained PU classifier. However, these predicted labels tend to be noisy, reducing the reliability of the supervision signals and thus worsening the performance for the conditional generative model. Besides, the noise depends on the accuracy of the given PU classifier. To address this issue, we focus on developing a novel noise-invariant conditional GAN that is robust to noisy labels provided by a specified classifier, e.g. a PU classifier. We call our method Classifier-Noise-Invariant Conditional Generative Adversarial Network~(CNI-CGAN) and the architecture is depicted in Figure~\ref{fig:architecture}. In the following, we elaborate on each part of it.

	\textbf{Principle of the Design of CNI-CGAN} Albeit being noisy, the pseudo labels given by the PU classifier still provide rich information that we can exploit. The key is to take the noise generation mechanism into consideration during generation. We denote the real data as $x_r$ and the predicted hard label through PU classifier as $PU_{\theta}(x_r)$, i.e., $PU_{\theta}(x_r)=\arg \max_i f^i_\theta(x_r)$, as displayed in Figure~\ref{fig:architecture}.  We let the generator  ``imitate'' the noise generation mechanism to generate pseudo labels for the labeled data. With both pseudo and real labels, we can leverage the PU classifier $f_\theta$ to estimate a confusion matrix $\tilde{C}$ to model the label noise from the classifier. During generation, a real label $y$, while being fed into the generator $G$, will also be polluted by $\tilde{C}$ to compute a noisy label $\tilde{y}$, which then will be combined with the generated fake sample $x_g$ for the following discrimination. Finally, the discriminator $D$ will distinguish the real samples $[x_r, PU_\theta(x_r)]$ out of fake samples $[x_g, \tilde{y}]$. Overall, the noise ``generation'' mechanism from both sides can be balanced.

	\textbf{Estimation of $\tilde{C}$} The key in the design of $\tilde{C}$ is to estimate the label noise of the pre-trained PU classifier by considering all the samples of each class. More specifically, the confusion matrix $\tilde{C}$ is $k+1$ by $k+1$ and each entry $\tilde{C}_{ij}$ represents the probability of a generated sample $x_g$, given a label $i$, being classified as class $j$ by the PU classifier. Mathematically, we denote $\tilde{C}_{ij}$ as:
	\begin{eqnarray} \begin{aligned}\label{eq:estimiation}
	\tilde{C}_{ij}=P(PU_{\theta}(x_g)=j|y=i)= \mathbb{E}_z[\mathbb{I}_{\{PU_{\theta}(x_g)=j | y=i\}}],
	\end{aligned} \end{eqnarray}
	where $x_g=G(z,y=i)$ and $\mathbb{I}$ is the indicator operator. Owing to the stochastic optimization nature when training deep neural networks, we incorporate the estimation of $\tilde{C}$ in the processing of training by \textit{Exponential Moving Average~(EMA) method}. We formulate the update of $\tilde{C}^{(l+1)}$ in the $l$-th mini-batch as follows:
	\begin{eqnarray} \begin{aligned}
	\tilde{C}^{(l+1)}=\lambda \tilde{C}^{(l)}+ (1-\lambda) \Delta_{\mathcal{X}_l}^{\tilde{C}},
	\end{aligned} \end{eqnarray}
	where $\Delta_{\mathcal{X}_l}^{\tilde{C}}$ denotes the incremental change of $\tilde{C}$ on the current $l$-th mini-batch data $\mathcal{X}_l$ via Eq.~\ref{eq:estimiation}. $\lambda$ is the averaging coefficient in EMA.

	\textbf{Theoretical Guarantee of Clean Data Distribution} Firstly, we denote $\mathcal{O}(x)$ as the oracle class of sample $x$ from an oracle classifier $\mathcal{O}(\cdot)$. Let $\pi_i, i=1,...,K\!+\!1$, be the class-prior probability of the class $i$ in the multi-postive unlabeled setting. Theorem~\ref{theorem:ours} proves the optimal condition of CNI-CGAN to guarantee the convergence to the clean data distribution. The proof is provided in Appendix~\ref{appendix_CNICGAN}.

	\begin{theorem}\label{theorem:ours}(Optimal Condition of CNI-CGAN)
		Let $P^g$ be a probabilistic transition matrix where $P^g_{ij}=P(\mathcal{O}(x_g)=j|y=i)$ indicates the probability of sample $x_g$ with the oracle label $j$ generated by $G$ with the initial label $i$. We assume that the conditional sample space of each class is disjoint with each other, then

		(1) $P^g$ is a permutation matrix if the generator $G$ in CNI-CGAN is optimal, with the permutation, compared with an identity matrix, only happens on rows $\mathbf{r}$ where corresponding $\pi_r, r\in \mathbf{r}$ are equal.

		(2) If $P^g$ is an identity matrix and the generator $G$ in CNI-CGAN is optimal, then $p^r(x,y)=p^g(x,y)$ where $p^r(x,y)$ and $p^g(x,y)$ are the real and generating joint distribution, respectively.

	\end{theorem}

	\begin{algorithm}[b!]
		\setstretch{0.01}
		\caption{Alternating Minimization for PU Learning and Classifier-Noise-Invariant Generation.}
		\textbf{Input}: Training data ($\mathcal{X}_p$, $\mathcal{X}_u$). Batch size $M$ and hyper-parameter $\beta > 0$, $\lambda, \kappa \in (0,1)$. $L_0$ and $L \in N^+$. Initialization of $\tilde{C}^{(1)}$ as identity matrix. Number of batches $N$ during the training. \\
		\textbf{Output}: Model parameter for generator $G$, and $\theta$ for the PU classifier $f_\theta$. \\
		\begin{algorithmic}[1]
			\STATE / * \textit{Pre-train  PU classifier $f_\theta$} * /

			\FOR{$i$ = 1 to $N$}

			\STATE Update $f_\theta$ by descending its stochastic gradient of $\widetilde{R}_{\mathrm{pu}}\left(f_{\theta} ; \mathcal{X}^{i}\right)$ via Eq.~\ref{eq:PU}.
			\ENDFOR

			\REPEAT

			\STATE / * \textit{Update  CNI-CGAN} * /

			\FOR{$l$ = 1 to $L$}
			\STATE Sample $\{\mathbf{z}_1,...,\mathbf{z}_M \}$, $\{\mathbf{y}_1,...,\mathbf{y}_M \}$ and $\{\mathbf{x}_1,...,\mathbf{x}_M \}$ from $P_Z$, $P_Y$ and all training data, respectively, and then sample $\{\mathbf{\tilde{y}}_1,...,\mathbf{\tilde{y}}_M \}$ through the current $\tilde{C}^{(l)}$. Update the discriminator $D$ by ascending its stochastic gradient of

			$$\frac{1}{M}\sum_{i=1}^{M}[\phi(D(\mathbf{x}_i, PU_\theta(\mathbf{x}_i)))]+\phi(1-D(G(\mathbf{z}_i,\mathbf{y}_i), \mathbf{\tilde{y}}_i))]$$

			\STATE Sample $\{\mathbf{z}_1,...,\mathbf{z}_M \}$ and  $\{\mathbf{y}_1,...,\mathbf{y}_M \}$ from $P_Z$ and $P_Y$, and then sample $\{\mathbf{\tilde{y}}_1,...,\mathbf{\tilde{y}}_M \}$ through the current $\tilde{C}^{(l)}$. Update the generator $G$ by descending its stochastic gradient of

			$$\frac{1}{M}\sum_{i=1}^{M}[\phi(1-D(G(\mathbf{z}_i,\mathbf{y}_i), \mathbf{\tilde{y}}_i))+\beta \ell_{\mathrm{aux}}(\mathbf{y}_i, \mathbf{z}_i)]$$

			\IF{$l \ge L_0$}

			\STATE Compute $\Delta_{\mathcal{X}_l}^{\tilde{C}} = \frac{1}{M}\sum_{i=1}^{M} \mathbb{I}_{\{PU_\theta(G(\mathbf{z}_i,\mathbf{y}_i))|\mathbf{y}_i\}}$ via Eq.~\ref{eq:estimiation}, and then estimate $\tilde{C}$ by

			$$\tilde{C}^{(l+1)}=\lambda \tilde{C}^{(l)}+ (1-\lambda) \Delta_{\mathcal{X}_l}^{\tilde{C}}$$
			\ENDIF

			\ENDFOR

			\STATE / * \textit{Update PU classifier via Data Augmentation} * /

			\STATE Sample $\{\mathbf{z}_1,...,\mathbf{z}_M \}$ and $\{\mathbf{y}_1,...,\mathbf{y}_M \}$ from $P_Z$ and $P_Y$, respectively, and then update the PU classifier $f_\theta$ by descending its stochastic gradient of

			$$\frac{1}{M} \sum_{i=1}^{M} \ell^{\mathrm{CE}} \left(f_\theta \left(G(\mathbf{z}_i,\mathbf{y}_i)\right),\mathbf{y}_i\right)$$

			\UNTIL convergence

		\end{algorithmic}
		\label{alg:framework}
	\end{algorithm}

	\textbf{The Auxiliary Loss} The optimal $G$ in CNI-CGAN can only guarantee $p^g(x,y)$ is close to $p^r(x,y)$ as the optimal permutation matrix $P^g$, i.e., a permutation matrix, is close to the identity matrix. Hence in practice, to ensure we can learn an identity matrix for $P^g$ and thus achieve the clean data distribution, we introduce an auxiliary loss to encourage a larger trace of $P^g$, i.e., $\sum_{i=1}^{K+1}P(\mathcal{O}(x_g)=i)|y=i)$. As $\mathcal{O}(\cdot)$ is intractable, we approximate it by the current PU classifier $PU_{\theta}(x_g)$. Then we obtain the auxiliary loss:
	\begin{eqnarray} \begin{aligned}
	\ell_{\mathrm{aux}}(z, y)= \max \{ \kappa - \frac{1}{K+1}\sum_{i=1}^{K+1}\mathbb{E}_z(\mathbb{I}_{\{ PU_{\theta}(x_g)=i|y=i \}}),  0\},
	\end{aligned} \end{eqnarray}
	where $\kappa \in (0,1)$ is a hyper-parameter. With the support of auxiliary loss, $P^g$ has the tendency to converge to the identity matrix where CNI-CGAN can learn the clean data distribution even in the presence of noisy labels.

	\textbf{Comparison with RCGAN~\cite{thekumparampil2018robustness, kaneko2019label}} The theoretical property of CNI-CGAN has a major advantage over existing Robust CGAN~(RCGAN)~\cite{thekumparampil2018robustness, kaneko2019label}, for which the optimal condition can only be achieved when the label confusion matrix is known \textit{a priori}. Although heuristics can be employed, such as RCGAN-U~\cite{thekumparampil2018robustness}, to handle the unknown label noise setting, these approaches still lack the theoretical guarantee to converge to the clean data distribution. Additionally, to guarantee the efficacy of our approach, one implicit and mild assumption is that our PU classifier will not overfit on the training data, while our non-negative estimator helps to ensure it as explained in Section~\ref{sec:PU}. It should be worthwhile to note that our CNI-CGAN conducts $K+1$ classes generation. To further clarify the optimization process of CNI-CGAN, we elaborate the training steps of $D$ and $G$, respectively.

	\noindent \textbf{D-Step:}	We train $D$ on an adversarial loss from both the real data and generated $(x_g, \tilde{y})$ where $\tilde{y}$ is corrupted by $\tilde{C}$. $\tilde{C}_y$ denotes the $y$-th row of $\tilde{C}$. We formulate the loss of $D$ as:
	\begin{eqnarray} \begin{aligned}
	\max_{D \in \mathcal{F}} \underset{x \sim p(x)}{\mathbb{E}}[\phi(D(x, PU_{\theta}(x)))]+\underset{z \sim P_Z, y \sim P_{Y} \atop \tilde{y} | y \sim \tilde{C}_{y}}{\mathbb{E}}[\phi(1-D(G(z,y), \tilde{y}))],
	\end{aligned} \end{eqnarray}
	where $\mathcal{F}$ is a family of discriminators and $P_Z$ is the distribution of latent space vector $z$, e.g., a Normal distribution. $P_Y$ is a discrete uniform distribution on $[K+1]$ and $\phi$ is the measuring function.

	\noindent \textbf{G-Step:}	We train $G$ additionally on the auxiliary loss $\ell_{\mathrm{aux}}(z, y)$ as follows:

	\begin{eqnarray} \begin{aligned}
	\min _{G \in \mathcal{G}} \underset{z \sim P_Z, y \sim P_{Y} \atop \tilde{y} | y \sim \tilde{C}_{y}}{\mathbb{E}}\left[\phi(1-D(G(z,y), \tilde{y}))+\beta\ell_{\mathrm{aux}}(z, y) \right],
	\end{aligned} \end{eqnarray}
	where $\beta$ controls the strength of auxiliary loss and $\mathcal{G}$ is a family of generators.

	\subsection{Training Framework}
	Firstly, we obtain a PU classifier $f_\theta$ trained on multi-positive and unlabeled dataset with the parallel non-negative estimator derived in Section~\ref{sec:PU}. Then we train our CNI-CGAN, described in Section~\ref{sec:CNI-CGAN}, on all data with pseudo labels predicted by the pre-trained PU classifier. As our CNI-CGAN is robust to noisy labels, we leverage the data generated by CNI-CGAN to conduct data augmentation to improve the PU classifier. Finally, we implement the joint optimization for the training of CNI-CGAN and the data augmentation of the PU classifier. We summarize the details in Algorithm~\ref{alg:framework} and Appendix~\ref{appendix:alg}.

	\textbf{Simultaneous Improvement on PU Learning and Generation with Extra Data} From the perspective of PU classification, due to the theoretical guarantee from Theorem~\ref{theorem:ours},  CNI-CGAN is capable of learning a clean data distribution out of noisy pseudo labels predicted by the pre-trained PU classifier. Hence, the following data augmentation has the potential to improve the generalization of PU classification regardless of the specific form of the PU estimator. From the perspective of generation with extra data, the predicted labels on unlabeled data from the PU classifier can provide the CNI-CGAN with more supervision signals, thus further improving the quality of generation. Due to the joint optimization, both the PU classification and the conditional generative models are able to improve each other reciprocally, as demonstrated in the following experiments.

	\section{Experiment}

	\textbf{Experimental Setup} We perform our approaches and several baselines on MNIST, Fashion-MNIST and CIFAR-10. We select the first 5 classes on MNIST and 5 non-clothes classes on Fashion-MNIST respectively for $K+1$ classification~($K=5$). To verify the consistent effectiveness of our method in the standard binary PU setting, we pick the 4 categories of transportation tools in CIFAR-10 as the one-class positive dataset. As for the baselines, the first is \textit{CGAN-P}, where a Vanilla CGAN~\cite{mirza2014conditional} is trained only on limited positive data. Another natural baseline is \textit{CGAN-A} where a Vanilla CGAN is trained on all data with labels given by the PU classifier. The last baseline is RCGAN-U~\cite{thekumparampil2018robustness} where the confusion matrix is totally learnable while training. For fair comparisons, we choose the same GAN architecture, and more details about hyper-parameters can be found in Appendix~\ref{appendix:experiement}.

	\textbf{Evaluation} For MNIST and Fashion-MNIST, we mainly use \textit{Generator Label Accuracy}~\cite{thekumparampil2018robustness} and \textit{PU Accuracy} to evaluate the quality of generated images. \textit{Generator Label Accuracy} compares specified $y$ from CGANs to the true class of the generated examples through a pre-trained (almost) oracle classifier $f$. In experiments, we pre-trained two $K\!+\!1$ classifiers with 99.28$\%$ and 98.23$\%$ accuracy on the two datasets, respectively. Additionally, the increased \textit{PU Accuracy} measures the closeness between generated data distribution and test (almost real) data distribution for the PU classification, serving as a key indicator to reflect the quality of generated images. For CIFAR 10, we take the \textit{Inception Score} into consideration.

	\begin{figure}[t!]
		\centering
		\centering\includegraphics[width=0.9\textwidth,trim=10 10 10 0,clip]{3Classification.pdf}
		\caption{Generation and classification performance of CGAN-P, CGAN-A and Ours on three datasets. Results of CGAN-P on PU accuracy do not exist since CGAN-P generates only $K$ classes data rather than $K+1$ categories that the PU classifier needs.}
		\label{fig:classification}
	\end{figure}

	\subsection{Generation and Classification Performance}
	We set the whole training dataset as the unlabeled data and select certain amount of positive data with the ratio of \textit{Positive Rate}. Figure~\ref{fig:classification} presents the trend of Generator Label Accuracy, Inception Score and PU Accuracy as the Positive Rate increases. It turns out that CNI-CGAN outperforms CGAN-P and CGAN-A consistently especially when the Positive Rate is small, i.e. little positive data. Remarkably, our approach enhances the PU accuracy greatly when exposed to low positive rates, while CGAN-A even worsens the original PU classifier sometimes in this scenario due to the existence of too much label noise given by a less accurate PU classifier. Meanwhile, when more supervised positive data are given, the PU classifier generalizes better and then provides more accurate labels, conversely leading to more consistent and better performances for all methods. Besides, note that even though the CGAN-P achieves comparable generator label accuracy on MNIST, it results in a lower Inception Score. We demonstrate this in Appendix~\ref{appendix:experiement}.

	To verify the advantage of theoretical property for our CNI-CGAN, we further compare it with RCGCN-U~\cite{thekumparampil2018robustness, kaneko2019label}, the heuristic version of robust generation against unknown noisy labels setting without the theoretical guarantee of optimal condition. As observed in Table~\ref{table_RCGANU}, our method outperforms RCGAN-U especially when the positive rate is low, and when the number of positive labeled data is relatively large, e.g., 10.0\%, both Ours and RCGAN-U obtain comparable performances.

	\begin{table}[htbp]
		\centering
		\caption{PU classification accuracy of RCGAN-U and Ours across three datasets. Final PU accuracy represents the accuracy of PU classifier after the data augmentation.}
		\scalebox{0.8}{
			\begin{tabular}{ccccccc}
				\hline
				\hline
				\multicolumn{2}{c}{\textbf{Final PU Accuracy $\backslash$ Positive Rates~(\%)}}&0.2\%&0.5\%&1.0\%&10.0\%\\
				\hline
				\multirow{3}*{MNIST}&Original PU&68.86&76.75&86.94&95.88\\
				~&RCGAN-U&87.95 &95.24&95.86 &\bf97.80\\
				~                   &Ours   &\bf96.33 &\bf96.43 &\bf96.71&\bf97.82 \\

				\hline
				\multirow{3}*{Fashion-MNIST}&Original PU&80.68&88.25&93.05&95.99\\
				~&RCGAN-U &89.21   &92.05   &94.59 &\bf97.24\\
				~                   &Ours   &\bf89.23 &\bf93.82 &\bf95.16&\bf97.33 \\
				\hline
				\multirow{3}*{CIFAR-10}&Original PU&76.79&80.63&85.53&88.43\\
				~&RCGAN-U &83.13  &86.22   &88.22   &\bf90.45\\
				~ &Ours   &\bf87.64&\bf87.92 &\bf88.60&\bf90.69 \\
				\hline
				\hline
		\end{tabular}		}
		\label{table_RCGANU}
	\end{table}

	\begin{figure}[b!]
		\centering
		\centering\includegraphics[width=0.9\textwidth,trim=10 180 30 180,clip]{2Visualization.pdf}
		\caption{Visualization of generated samples on three datasets. Rows below the red line represent the negative class. We highlight the erroneously generated images with red boxes on MNIST.}
		\label{fig:visualization}
	\end{figure}

	\textbf{Visualization} To further demonstrate the superiority of CNI-CGAN compared with the other baselines, we present some generated images within $K+1$ classes from CGAN-A, RCGAN-U and CNI-CGAN on MNIST, and high-quality images from CNI-CGAN on Fashion-MNIST and CIFAR-10, in Figure~\ref{fig:visualization}. In particular, we choose the positive rate as 0.2$\%$ on MNIST, yielding the initial PU classifier with 69.14$\%$ accuracy. Given the noisy labels on all data, our CNI-CGAN can generate more accurate images of each class visually compared with CGAN-A and RCGAN-U. Results of Fashion-MNIST and comparison with CGAN-P on CIFAR-10 can refer to Appendix~\ref{appendix:visualization}.

	\subsection{Robustness of Our Approach}

	\textbf{Robustness against the Initial PU accuracy} The auxiliary loss can help the CNI-CGAN to learn the clean data distribution regardless of the initial accuracy of PU classifiers. To verify that, we select distinct positive rates, yielding the pre-trained PU classifiers with different initial accuracies. Then we perform our method based on these PU classifiers. Figure~\ref{fig:speed} suggests that although better initial PU accuracy can be beneficial to the initial generation performance, our approach under different PU accuracies can still attain the similar generation quality after sufficient training.

	\begin{figure}[hbtp]
		\centering
		\centering\includegraphics[width=0.85\textwidth,trim=10 90 20 50,clip]{5Speed.pdf}
		\caption{Tendency of generation performance as the training iterations increaseon three datasets.}
		\label{fig:speed}
	\end{figure}

	\textbf{Robustness against the Unlabeled data} In real scenarios, we are more likely to have little knowledge about the extra data we have. To further verify the robustness of CNI-CGAN against the unknown distribution of extra data, we test different approaches across different amounts and distributions of the unlabeled data. Particularly, we consider two different types of distributions for unlabeled data. Type 1 is $[\frac{1}{K+1}, ... ,\frac{1}{K+1},\frac{1}{K+1}]$ where the number of data in each class, including the negative data, is even, while type 2 is $[\frac{1}{2K}, ... \frac{1}{2K},\frac{1}{2}]$ where the negative
	data makes up half of all unlabeled data. In experiments, we focus on the PU Accuracy to evaluate both the generation quality and the improvement of PU learning. For MNIST, we choose 1$\%$ and 0.5$\%$ for two settings while we opt for 0.5$\%$ and 0.2$\%$ on both Fashion-MNIST and CIFAR-10.

	\begin{figure}[htbp]
		\centering
		\centering\includegraphics[width=1.0\textwidth,trim=110 20 130 50,clip]{4Sensitivity.pdf}
		\caption{PU Classification accuracy of CGAN-A, RCGAN-U and Ours after joint optimization across different amounts and distribution types of unlabeled data.}
		\label{fig:sensitivity}
	\end{figure}

	Figure~\ref{fig:sensitivity} manifests that the accuracy of PU classifier exhibits a slight ascending tendency with the increasing of the number of unlabeled data. More importantly, our CNI-CGAN almost consistently outperforms other baselines across different amount of unlabeled data as well as distinct distributions of unlabeled data. This verifies the robustness of our proposal to the situation of extra data.

	\section{Discussion and Conclusion}

	In this paper, we proposed a new method, CNI-CGAN, to jointly exploit PU classification and conditional generation. It is, to our best knowledge, the first method of such kind to break the ceiling of class-label scarcity, by combining two promising yet separate methodologies to gain massive mutual improvements. CNI-CGAN can learn the clean data distribution from noisy labels given by a PU classifier, and then enhance the performance of PU classification through data augmentation in various settings. We have demonstrated, both theoretically and experimentally, the superiority of our proposal on diverse benchmark datasets in an exhaustive and comprehensive manner. In future, it will be promising to investigate learning strategies on imbalanced data, e.g., cost-sensitive learning~\cite{elkan2001foundations}, to extend our approach to broader settings, which will further cater to real-world scenarios where only highly unbalanced data are available.

	\section*{Broader Impact}
	The scarcity of class-labeled data is prevalent in real applications. Our method investigates the simultaneous improvement of both generation and classification, two basic settings in machine learning problem, under this circumstance by leveraging extra unlabeled data.  Our strategy has huge potential that can have beneficial impacts on any research and engineer fields where basic classification or generative models are built. The solution in our work is able to help reduce the appetite of labeled data, and can be further employed in a wide range of real tasks, including weakly and semi-supervised learning, medical imaging research as well as other artificial intelligence tasks. Then the tense for a large amount of labeled data can be eased, and the economical costs can be significantly saved by the leverage of our approach. However, there are also some potential risks for the deploy of our method in some real scenarios. As we normally have little knowledge about the extra data, the efficacy of our proposal in the heavily imbalanced situation can not be certainly reliable without the incorporation of any other imbalanced learning strategies.

	\bibliographystyle{plain}


\section{Introduction}

COVID-19 in an infectious respiratory disease that has been declared a pandemic by the United Nations (UN) World Health Organization (WHO)~\cite{cucinotta2020declares}. Affecting the lungs, it makes them stiff, thus difficulting breathing. Usually, the air we pull through the trachea branches into each lung. Then, it keeps splitting subsequently into smaller pipes, eventually reaching the bronchioles and afterward the alveoli, which are microscopic sacs of air~\cite{aguiar2020inside}.
SARS-CoV-2 (the Severe Acute Respiratory Syndrome Coronavirus-2), the virus causing COVID-19, promotes the creation of an exudate that fills the alveoli impeding gas exchange~\cite{tian2020pathological}. In terms of the  COVID-19 infection, it is still too early to assess the portion of the population that is immune, is asymptomatic, requires hospitalization,   needs a ventilator, and eventually  perish~\cite{gonzalez2020sars}.
For the sake of discussion, consider the case of symptomatic people.
The most frequent symptoms at the beginning are fever, cough, and fatigue. Other signs that appear afterward include sputum production, myalgia, headache, hemoptysis, diarrhea, dyspnea, and lymphopenia~\cite{rothan2020epidemiology}.
Nonetheless, it is still unclear what circumstances cause a particular person to show symptoms, and significant statistics are overdue to provide some light.  Consider, for instance, that while a study suggests that up to 50\% of the population of Iceland is asymptomatic~\cite{gudbjartsson2020spread},
in India, a survey showed that 47.1\% of the infected population is asymptomatic and 35.3\% showed mild symptoms~\cite{thangaraj2020cluster}. In the meantime,  in a Boston shelter out of 408 people, 147 tested positive, and 361 reported no symptoms~\cite{baggett2020prevalence}.
Thus, to reign over confusion, we need to generate and spread trustable information quickly, reliably, and efficiently.

Maps are a suitable solution as one may obtain a vast amount of information quickly~\cite{knudsen2020evolution}. There have been numerous attempts to develop visualizations of the spread of the COVID-19. For instance, Dong {\it et al.}~\cite{dong2020interactive}, at John Hopkins University, created a worldwide map of cases, including every country where there was at least one case.  To understand the complexity of such a task, one may want to consider that it includes the problems associated with gathering a vast amount of information from several centers of production, each with its data format and produced at different speeds~\cite{roser2020coronavirus}. Across the visualizations of the spread of COVID-19, one finds tradeoffs between the scope of the coverage and the level of detail provided. Although a milestone achievement, until recently, Mexico was represented in this and other worldwide maps as a single point.
Thus, there is a clear need to develop local and updated versions of maps to support the availability of reliable information using efficient and comprehensive coverage means.

In this document, we describe maps to assess the magnitude of the epidemy and to guide the process of returning to normality. In the former case, we emphasize that keeping up with the spread of COVID-19 is a complex problem by itself. Just consider that Mexico has a population of 130 million people, which extends over 1.973 million km$^2$. Its geography includes 32 states, first-level administrative divisions in the country. In turn, each state is divided politically into more than 2450 municipalities, second-level administrative divisions. As the pandemic progress, governments have implemented lockdown actions to augment social distancing.
In consequence, the economic factors start increasing its relative importance. Just a result of the pandemic, the European Commission has projected a shrink in the EU GDP  of 7.4\%~\cite{kinross2020rapidly}, the US economy is in its way to reaching a 20\% of unemployment~\cite{atkeson2020will}, and the Chinese economy shrank 6.8\% in the first quarter of 2020, ending a 50 years long run of growth~\cite{khan2020china}. With these three engines of the global economy turned off, others will falter. So, there is an apparent need to open as soon as possible the economy while making sure that the health aspects are kept at bay. Thus, this work contributes to addressing the urgent need for rapid, updated, and reliable information at the municipality and state level.

\begin{figure*}
\centering
\begin{tabular}{cc}
\includegraphics[width=3in]{delays.pdf}  & \includegraphics[width=3in]{delays20days.pdf} \\
(a) Full observation range &
(b) Last 20 days\\
\end{tabular}
\caption{Delays in Acquiring the Data. Due to delays in diagnosis, testing,
and information processing flow, there is a delay of a considerable number of days between the date of first symptoms and availability for analysis.
}
\label{fig:delays}
\end{figure*}

\section{Confirmed Positive, Pending and Deceased}

In this map, we show, at Municipio and State levels of granularity, the number of confirmed positive, pending, and deceased cases of COVID-19 and associate them with their place of residence  (see Figure~\ref{fig:covid-spread-cases}).

\subsection{Preprocessing the Data}
The Mexican government, through its Health Ministry, releases every day, since April 12, 2020, a dataset containing the registers of individual cases~\cite{dataset}. The dataset, which fields we describe in detail in Appendix~\ref{app:data}, is the source of information we employ in our maps. For our purposes, we extract patients' data, including their State of residence, their Municipio of residence, the result of their tests (confirmed, positive or negative, or pending) and date of death (when appropriated). Please note that, in the case of COVID-19, the generation of maps is a dynamic process that includes a large number of stages. Consider, for instance, the example of a patient that starts feeling COVID-19 symptoms. Once the patient decides to visit the care provider, a physician may determine a need for a test. Depending on the available infrastructure, the test may have to travel to a nearby location. After a few days, the results come back to the physician, who fills out a local agency report. The national network of health care providers collects these results and finally makes them public. In Figure~\ref{fig:delays}, we illustrate the daily update of positive confirmed cases occurring in the country. Note that there may be a delay of more than 20 days between a self-reported start of symptoms until the data is finally officially registered. These delays may make it harder to assess the magnitude of the epidemy and to develop plans of action.

\begin{figure*}[t]
    \centering
    \begin{tabular}{c}
    \includegraphics[width=4.7in, trim=10 10 10 55, clip]{countState.pdf} \\ (a)\\ \includegraphics[width=5in, trim=0 200 0 0, clip]{countMunicipioDetail.pdf}\\
    (b) \\
    \end{tabular}
    \caption{Confirmed, deceased and pending cases of COVID-19 in Mexico at state (a) and municipal(b) level.  }
    \label{fig:covid-spread-cases}
\end{figure*}

To efficiently organize the information int the dataset, we create data tables employing FileMaker~\cite{filemaker}, a database management system that facilitates the incorporation of a  Graphical User Interface (GUI). The database consists of six tables: {\tt current}, {\tt previous}, {\tt municipalities}, {\tt states}, {\tt statistics.mu\-ni\-ci\-palities}  and {\tt statistics.states}. The {\tt current} and  {\tt previous} tables have a structure corresponding to the fields in the data file published by the government (see Appendix~\ref{app:data}). The {\tt municipalities} and {\tt states} tables contain the name, the latitude, and the longitude of the place to locate it on the map. The tables {\tt statistics.mu\-ni\-ci\-palities} and {\tt statistics.states} hold the number of positively confirmed, deaths,  pending results, difference of each of the indicators to the previous day, and boolean fields with indicators changing depending on whether the current value is greater or smaller to the day before. We calculate summaries by State and Municipio searching on the {\tt statistics.states} and  {\tt statistics.mu\-ni\-ci\-palities} tables.

\subsection{Data Visualization }
 We display the data as circles which size is proportional to the population they represent,  locating the geographic coordinates from ubicated points on the interactive maps in unities of latitude and longitude (see Figure \ref{fig:covid-spread-cases}). We also include timeline graphs alongside the state-level map (see Figure \ref{fig:covid-spread-cases}(a)). These graphs show chronologically the new and accumulated confirmed cases, daily and accumulated deaths, and cases with pending results since the Health Ministry released the public database. The user can select a state to filter its corresponding data within the map view, and this shows a state-specific graph. When there is no selection, the data for every state is added, showing a nation-wide timeline graph.
It is important to note that the graphs for confirmed cases show the data on the dates reported by the Health Ministry. This date may or may not be the date when the care provider registered the test result, as the dataset does not include that information. In the case of deaths, the official dataset usually reports them days after the passing occurred, but provide the date of death; thus, we generate a timeline graph by the actual date. Given this delay in reporting, the graphs for deaths are prone to changes with each daily update, and numbers for recent dates are most likely to increase.

During the updating process, we compare our results with the official report as an initial quality check. Afterward, we use the following policies: a) When a record does not have a Municipio of residence, we assign it to the State capital; b) if there is a missing State of residence information, the record is marked as unidentified and assigned to the country capital. We calculate daily the difference between the confirmed positives, pending, and deaths with the previous day. To improve the visualization impact, we include an arrow upward $\Uparrow$ whenever there is an increase; on the contrary, we show a downward arrow  $\Downarrow$ to signal a decrement in the indicator. After processing the data, we export the corresponding data file and upload it to overwrite the data layer in the map project. We register the date and hour of the update.  The map shows the municipalities with at least one case of COVID-19. As well as an ordered list, from high to low, of the incidence of the disease.

We separately process the data we use for the State-level graphs. Even when the public dataset is updated daily, the records within it lack the date when the Health Minister first included them. Therefore, we collect all the uploaded datasets to compare each with the previous one and determine which records are new. We do this to obtain the daily new and total positive cases and cases awaiting the state's results. In the case of deaths, we only use the last updated public dataset as the date of death is included in each record. We process this information in {\bf R} (the computer language) and output the collected data as CSV (comma separated variables) files that specify the date and state for each statistic. We then upload these CSV files to the map project to generate the graphs.
\section{Basic Number of Reproduction}

In the previous section, we addressed the problems of increasing awareness on the magnitude of the epidemy in terms of the number of people confirmed positive, suspected, and deceased at the municipal and state level. Rapid access to that information supports the mobilization of sanitary and psychological resources. A complementary piece of information to guide the public on the magnitude of the epidemic is the basic reproduction number, $R_t$, which represents the indicator that should govern society on whether the contagious increase, $R_t>1 $, or decrease, $R_t <1$.

\begin{figure}[h]
    \centering
    \begin{tabular}{ccc}
    \begin{minipage}{1in}
    \includegraphics[width=2in,trim=0 35 90 0, clip]{SIR.pdf}
    \end{minipage}&
    \begin{minipage}{2.5in}
          \includegraphics[width=2.5in]{SIR01.pdf}
          \end{minipage}&
          \begin{minipage}{2.5in}
          \includegraphics[width=2.5in]{R_0.pdf}
          \end{minipage}\\
          (a) & (b) & (c) \\
        \end{tabular}
    \caption{SIR Model. In SIR, one divides the population into susceptibles, infected and recovered, and may move those categories subsequently (a). The variation in the population among the groups obey differential equations (b), commanded by the value of $R_t$ (c).}
    \label{fig:SIR}
\end{figure}

\subsection{Interpretation of $R_t$ in the SIR Model}
Back in 1927, Kermack and McKendrick~\cite{kermack1927contribution} proposed the SIR model to interpret infectious diseases. They assumed that the whole number of individuals $N$ in a population could be divided disjointly in suspected $S$, infected $I$, and recovered $R$. Another assumption in the model is that susceptibles may become infected, infected may become recovered, and recovered do not become infected again (see Figure ~\ref{fig:SIR}).

This setting leads to a dynamic system where the number of susceptibles decreases over time as a fraction $a$ of the number of interactions between susceptibles and infected, where we are dropping the dependency on $t$ for clarity, as
\begin{equation}
\partial S/\partial t
= - a \frac {I S} {N}.
\end{equation}
Meanwhile, the number of infected increases by the interaction
between infected and susceptibles but decreases by the fraction of infected people recovering as
\begin{equation}
\partial I/\partial t
= a \frac {I S} {N} - b I.
\label{eq:dinfected}
\end{equation}
Finally, the number of recoveries increases as a proportion of the
infected as
\begin {equation}
\partial R/\partial t
= b I.
\end {equation}
Here $a$ and $b$ are proportionality constants reflecting the inverse of the number of interactions in units of time. Their units are {\it people}$^{-1}\cdot$ {\it time}$^{- 1}$.

One may express (\ref{eq:dinfected}), the equation expressing the rate at which  the number of infected changes,  as
\begin{equation}
\partial S/\partial t
= I \left (a \frac {S} {N} - b \right),
\end{equation}
which has a solution
\begin{equation}
I = I_0 \displaystyle {e^{\left (a \frac {S} {N} -
b \right) t}},
\end{equation}
where $I_0$ is the initial number of infected,
that grows indefinitely if the exponent is positive and
 fades if it is negative.
One may express the stability condition as
\begin{equation}
\begin{array} {ccc}
a \frac{S} {N} - b = 0 & \mbox {ó} & \frac {aS} {bN} = 1.
\end {array}
\end{equation}
Thus, one may express the basic reproduction number
or average number of secondary cases caused by an infected person, as
\begin{equation}
R_t = \frac {aS} {b N},
\end{equation}
which indicates that the number of infected will increase, when $R_t>1$, or decrease, when $R_t <1$.

\subsection{Bayesian Solution for $R_t$}
To estimate the most likely value for a random variable $R_t$, one would have to have some kind of  tracking capability to solve among other factors who is infected, when the infection started, what people contacted the infectee, and who among these people contracted the infection. In addition, there would be the need follow this process during the evolution of the epidemy, something that may be harder as the infection spread.
Thus, one should make some general assumptions to model the phenomenon in practice due to these difficulties. One of them is that the rate at which an infected person spread the disease to others follow a Poisson process described as~\cite{cori2013new}
\begin{equation}
P(I_t\mid I_0, \dots, I_t, {\mathbf{w}}, R_t) =  \frac{(R_t \Lambda_t)^{I_t} e^{-R_t \Lambda_t}}{I_t!},
\end{equation}
where $I_k$ corresponds to the number of infections at time $k$,  ${\mathbf{w}}$ defines the serial interval for the spread, in the form of a mass probability density, and one defines the expected number of infectious as~\cite{cori2013new}
\begin{equation}
\mathbb{E} [I_t] = R_t \sum_{s=1}^t I_{t-s} w_s = R_t \Lambda_s.
\end{equation}
There are several approaches to estimate the parameters that maximize the probability distribution, including maximum likelihood, maximum a posteriori probability, and a general Bayesian approach~\cite{prince2012computer}. The latter is interesting as it permits us to present the results as a general probability distribution without committing to a point estimate. To that end, one needs to propose a {\it prior}, which form one has to assume known. Cori {\it et al.}~\cite{cori2013new} propose to use a Gamma distribution for $P(R_{t, \tau})$ as
\begin{equation}
P(R_{t, \tau}) = \frac{R_{t,\tau}^{a-1}}{\Gamma{(a)} b^a}  e^{-R_{t,\tau}/b},
\end{equation}
where $a$ and $b$ correspond respectively to the shape and scale. This arrangement is fortunate as the Poisson distribution along with a Gamma distribution as its conjugate results in a Gamma distribution expressed as~\cite{cori2013new}
\begin{dmath}
P(I_{t - \tau +1}, \dots, I_t, R_{t,\tau}\mid I_0, \dots, I_{t-\tau}, {\mathbf{w}})
= R_{t,\tau}^{\alpha - 1}
    e^{R_{t,\tau}/ \beta}
\prod_{s = t - \tau + 1}^t \frac{\Lambda_s^{I_s}}{I_s!} \frac{1}{\Gamma(a)b^a}.
\end{dmath}
From where one may obtain  the shape and scale  parameters, which transformed into the mean and standard deviation results in
\begin{equation}
\alpha = a + \displaystyle{\sum_{s=t - \tau +1} I_s} \mbox{ y }
\beta = \frac{1}{\displaystyle{\sum_{s=t-\tau+1}^{t} \Lambda_s} +\frac{1}{b}}.
\end{equation}

\begin{figure}[t]
    \centering
    \includegraphics[width=4in,trim=0 80 80 0, clip]{diseaseStages.pdf}
    \caption{Infectious stages. Once contagious occurs, our interest centers on the duration of the incubation period, the infectious period, and the latent period.}
    \label{fig:stages}
\end{figure}

As a consequence of the Bayesian process, the posterior,$P(I_{t - \tau +1}, \dots, I_t, R_{t,\tau})$, has a mean value and standard deviation  for the Gamma distribution given by
\begin{equation}
\mu = \frac{a + \sum_{s = t - \tau + 1}^{t} I_s}
{\frac{1}{b} + \sum_{s = t - \tau + 1}^{t} \Lambda_s},
\mbox{ and }
\sigma =  \frac{a + \sum_{s = t - \tau + 1}^{t} I_s}
{\left(\frac{1}{b} + \sum_{s = t - \tau + 1}^{t} \Lambda_s\right)^2}.
\end{equation}

Once exposed, a person infected passes through a series of stages of interest for our modeling (see Figure~\ref{fig:stages}). Practitioners call {\it incubation period} to the time between the acquisition of the virus and the onset of symptoms. Also, they call  {\it latent period} to the time between the acquisition of the infectious and the beginning of the infectious period. Please note that if the latent period is less than the incubation period, the person infected may start infecting others without showing symptoms. Still, there seem to be people passing through the infectious period without showing symptoms~\cite{nishiura2020estimation}. Indeed it may be the case that people may start recovering before or after the infectious period, but that does not affect Cori {\it et al.}~\cite{cori2013new} model.

\begin{figure*}
    \centering
    \begin{tabular}{c}
\includegraphics[width=6in]{RtState.pdf} \\
(a) \\
\includegraphics[width=6in]{RtMunicipio.pdf}\\
 (b)\\
    \end{tabular}
    \caption{Basic Reproduction Number $R-t$  of COVID-19 in Mexico at state (a) and municipal  (b) level.  }
    \label{fig:covid-spread}
\end{figure*}

\section{Results}
We implemented Cori {\it et al.}~\cite{cori2013new} model using the {\bf R} (the language) library {\it EpiEstim}. Cori {\it et al.} assumed that the rate at which a person infects others follows a Poisson process. They then use a Bayesian inference process where they assume a {\it prior} in the form of a Gamma distribution, resulting in a {\it  posterior } that also follows a Gamma distribution. We provide the resulting mean and standard deviation in our maps as the most plausible element of the estimate's behavior and uncertainty. Following the recommendation of Cori {\it et al.}, we calculate $ R_t $ only when the number of cases is greater than 12.  Also, using the research by Aghaali {\it et al.}~\cite{aghaali2020estimation}, we assign a mean of 4.55 and a standard deviation of 3.3 to the  Gamma {\it prior}. We are noting that the characterization of the serial interval varies widely and possibly requires values that reflect the dynamics of the country~\cite{griffin2020rapid}.

\begin{figure}[h]
    \centering
    \includegraphics[width=3in]{gamma2020.pdf}
    \caption{Gamma Prior. Illustration for the Gamma distribution for some parameters in the literature.}
    \label{fig:shapeScale}
\end{figure}

The model requires the definition of parameters, including the incubation, the latent, and the infectious periods. Once infected, people seem to have an incubation period with means that range from 5.1 to 5.84 days,  with 95\% of the population covered after a means ranging from 11.5 to 12.5 days~\cite{lauer2020incubation, han2020estimate, li2020early}. Still, there are reports of ultralong incubation periods of 38 days~\cite{wang2020case}, giving rise to the need for more studies~\cite{cimolai2020more}. There is still some debate on whether infected people start spreading COVID-19 before showing symptoms~\cite{bae2020chinese,yu2020familial}, although there may be some evidence tilting toward that conjecture with ranges between one and four days. Byrne {\it et al.}~\cite{byrne2020inferred} compiled 48 articles to define the period of infectious. Interestingly, they found that for asymptomatic people, the median ranges from 6.5 to 9.5 days; for not hospitalized, the median is 13.4 days, and for hospitalized people, it is 18.1 days. Thus, in our model, we use $\tau$ equal to 13.4 days.

One also needs to provide the parameters for the Gamma prior. There is a significant problem with obtaining these values, as one needs to be able to trace contacts for many people carrying an infectious. Nishiura {\it et al. } ~\cite{nishiura2020serial}, Zhao {\it et al.}~\cite{zhao2020serial}, and Aghaali {\it et al.}~\cite{aghaali2020estimation} calculated a mean value  $\mu$ between 4.4 and 4.8 and standard deviation $\sigma$ between  2.7 and 3.3, with a number of cases studied $n$ varying between  18 and 318 (see Figure ~\ref{fig:shapeScale}). Still, Griffin {\it et al.}~\cite{griffin2020rapid} found a variation for $\mu$ between 3.1 and 7.5 in 22 estimates.

\begin{figure}[t]
    \centering
    \includegraphics[width=4in]{RtSLP.pdf}
    \caption{Daily Estimate of $R_t$. Here, we plot $R_t$ mean value and the 95\% CI under a shaded area around it. We plot a horizontal blue line for $R_t = 1$, and a vertical red dashed line at the furthest date in the past where there was a change between the current report the one presented one day before. From that day on, we plot with a dashed line the estimate of the mean value of $R_t$. }
    \label{fig:RtEstimate}
\end{figure}

We display $R_t$ as choropleth maps at municipal and state levels of granularity using a red shading pattern for polygons whose value is equal to or greater than one and a yellow to white shading pattern whose value is below one (see Figure~\ref{fig:covid-spread}).
To construct the charts, for each entity under analysis, we compared the records between the most current data set and the previous day. Then, we found the most remote date when there was a change from one day to the next in the number of confirmed cases. Finally, we show both a vertical dashed line on that date, and from that day on, we continue the estimation of $R_t$ with a dashed line for the rest of the timeline. The estimate of $ R_t $ has an uncertainty range that we shadow around the mean (see Figure~\ref{fig:RtEstimate}).

One can access our maps to visualize the number of confirmed, suspected, and deceases cases at \url{https://tinyurl.com/mexico-covid19-count}, while one access the map to visualize the estimation of $R_t$  at \url{https://tinyurl.com/mexico-Rt}. In both cases, we used ArcGIS as the software platform.

\section*{Conclusion}
There is an identified need to learn locally about the spread of COVID-19 to make informed decisions. Using official data publicly sourced by the Mexican Health Ministry, we introduced two visualizations: In one, we map the magnitude of positively confirmed, pending, and deceased cases and in another where we mapped the basic reproduction number $R_t$, both at state and municipal level. Combined, they provide complete information about the magnitude and direction of the epidemy. Daily, we update the maps as new information becomes available.

As our understanding of COVID-19 increases, there is the opportunity to incorporate that knowledge into visualization tools. Researchers and practitioners in areas as diverse as epidemiology, sociology,
economy, and computing may bring new ideas to tackle the pandemic's consequences. As further information becomes available, dynamic visualization tools may provide a form of rapid form of communication to gain insight. This is especially true in the local information case as it may provide critical insights about the dynamics, culture, and phenomena impacting the spread of COVID-19.

\section*{Acknowledges}
Thanks to the Mexican Health Ministry for making publicly available the dataset on top of which we construct this work.