  Considering a continuous random variable $Y$ together with a continuous
random vector $X$, I propose a nonparametric estimator $\hat{f}(\cdot|x)$ for
the conditional density of $Y$ given $X=x$. This estimator takes the form of an
exponential series whose coefficients $\hat{\theta}_{x}=(\hat{\theta}_{x,1},
\dots,\hat{\theta}_{x,J})$ are the solution of a system of nonlinear equations
that depends on an estimator of the conditional expectation $E[\phi (Y)|X=x]$,
where $\phi$ is a $J$-dimensional vector of basis functions. The distinguishing
feature of the proposed estimator is that $E[\phi(Y)|X=x]$ is estimated by
generalized random forest (Athey, Tibshirani, and Wager, Annals of Statistics,
2019), targeting the heterogeneity of $\hat{\theta}_{x}$ across $x$. I show
that $\hat{f}(\cdot|x)$ is uniformly consistent and asymptotically normal,
allowing $J \rightarrow \infty$. I also provide a standard error formula to
construct asymptotically valid confidence intervals. Results from Monte Carlo
experiments and an empirical illustration are provided.
