  We assess a neural network (NN) method for reconstructing 3D cosmological
density and velocity fields (target) from discrete and incomplete galaxy
distributions (input). We employ second-order Lagrangian Perturbation Theory to
generate a large ensemble of mock data to train an autoencoder (AE)
architecture with a Mean Squared Error (MSE) loss function. The AE successfully
captures nonlinear features arising from gravitational dynamics and the
discreteness of the galaxy distribution. It preserves the positivity of the
reconstructed density field and exhibits a weaker suppression of the power on
small scales than the traditional linear Wiener filter (WF), which we use as a
benchmark. In the density reconstruction, the reduction of the AE MSE relative
to the WF is $\sim 15 \%$, whereas, for the velocity reconstruction, a relative
reduction of up to a factor of two can be achieved. The AE is advantageous to
the WF at recovering the distribution of the target fields, especially at the
tails. In fact, trained with an MSE loss, any NN estimate approaches the
unbiased mean of the underlying target given the input. This implies a slope of
unity in the linear regression of the true on the NN-reconstructed field. Only
for the special case of Gaussian fields, the NN and WF estimates are
equivalent. Nonetheless, we also recover a linear regression slope of unity for
the WF with non-Gaussian fields.
