How to Implement Regularization on Neural Networks