@@ -0,0 +1,1752 @@
+import os, time, json%0Afrom openml.apiconnector import APIConnector%0Afrom scipy.io.arff import loadarff%0Aimport numpy as np%0Aimport matplotlib.pylab as plt%0Afrom sklearn.ensemble import RandomForestClassifier%0Afrom sklearn.cross_validation import cross_val_score%0Afrom sklearn.metrics import get_scorer, zero_one_loss%0Afrom sklearn.neural_network import MLPClassifier%0A%0A%0A%0Adef get_dataset(did):%0A    home_dir = os.path.expanduser(%22~%22)%0A    openml_dir = os.path.join(home_dir, %22.openml%22)%0A    cache_dir = os.path.join(openml_dir, %22cache%22)%0A    %0A    with open(os.path.join(openml_dir, %22apikey.txt%22), 'r') as fh:%0A        key = fh.readline().rstrip('%5Cn')%0A    fh.close()%0A    %0A    openml = APIConnector(cache_directory = cache_dir, apikey = key)%0A    dataset = openml.download_dataset(did)%0A    # print('Data-set name: %25s'%25dataset.name)%0A    # print(dataset.description)%0A    data, meta = loadarff(dataset.data_file)%0A    target_attribute = dataset.default_target_attribute%0A    target_attribute_names = meta%5Btarget_attribute%5D%5B1%5D%0A    X, y, attribute_names = dataset.get_dataset(target = target_attribute, return_attribute_names = True)%0A    %0A    return X, y, attribute_names, target_attribute_names%0A%0Aif __name__ == '__main__':%0A    ## get dataset - MNIST%0A    X, y, attribute_names, target_attribute_names = get_dataset(554)%0A    %0A    ## 60,000 as training data, 10,000 as test data%0A    X_train, X_test = X%5B:60000%5D, X%5B60000:%5D%0A    y_train, y_test = y%5B:60000%5D, y%5B60000:%5D%0A    %0A    nn_clf = MLPClassifier(hidden_layer_sizes = (100,), algorithm = 'sgd', max_iter = 1000000, learning_rate = 'constant', learning_rate_init = 0.001)%0A    %0A    nn_clf.fit(X_train, y_train)%0A    %0A    error_rate = zero_one_loss(y_test, nn_clf.predict(X_test))%0A    %0A    print('Error rate: %7B%7D'.format(error_rate))

add neural network mnist