Neural network analysis of neutron and X-ray reflectivity data: Incorporating prior knowledge for tackling the phase problem