Added prediction function and regularization