Added some functions for logistic regression