working logistic regression for MNIST