Logistic regression for mnist