Added scripts for checking the gradient and doing cross-validation