Teaching a Neural Network to Attach and Detach Electrons from Molecules