Neural network task specialization via domain constraining