Recovering Pairwise Interactions Using Neural Networks