def test_part3_1(): """ Test from part2 should be working """ X,Y = get_exam_dataset() X,Y = normalize_data(X,Y) log_reg = MulticlassLogisitcRegression(classes = 2) log_reg.fit(X,Y) accuracy = evaluate(log_reg, X, Y) print "Accuracy ",accuracy assert(accuracy > 0.8)
def test_part3_2(): X, Y = get_MNIST_training_normalized() print "Normalized MNIST dataset loaded" ml_log_reg = MulticlassLogisitcRegression(10) ml_log_reg.fit(X,Y) print "Fitted logistic regression" X_test, Y_test = get_MNIST_testing_normalized() print "Normalized MNIST testing dataset loaded" accuracy = evaluate(ml_log_reg, X_test, Y_test) print "Accuracy on test dataset = ", accuracy assert(accuracy > 0.8) return ml_log_reg