@@ -0,0 +1,1746 @@
+import matplotlib.pyplot as plt%0Aimport seaborn as sns%0Aimport numpy as np%0A%0Afrom sklearn.model_selection import train_test_split%0Afrom sklearn.linear_model import LogisticRegressionCV%0A%0Afrom keras.models import Sequential%0Afrom keras.layers.core import Dense, Activation%0Afrom keras.utils import np_utils%0A%0A# https://github.com/fastforwardlabs/keras-hello-world/blob/master/kerashelloworld.ipynb%0A%0Adef one_hot_encode_object_array(arr):%0A    uniques, ids = np.unique(arr, return_inverse=True)%0A    return np_utils.to_categorical(ids, len(uniques))%0A%0Adef iris_sklearn():%0A    iris = sns.load_dataset(%22iris%22)%0A%0A    X = iris.values%5B:, :4%5D%0A    y = iris.values%5B:, 4%5D%0A%0A    train_X, test_X, train_y, test_y = train_test_split(X, y, train_size=0.5, random_state=0)%0A%0A    lr = LogisticRegressionCV()%0A    lr.fit(train_X, train_y)%0A%0A    print(%22Accuracy (Logistic regressioin) = %7B:.2f%7D%22.format(lr.score(test_X, test_y)))%0A%0Adef iris_keras():%0A    iris = sns.load_dataset(%22iris%22)%0A%0A    X = iris.values%5B:, :4%5D%0A    y = iris.values%5B:, 4%5D%0A%0A    train_X, test_X, train_y, test_y = train_test_split(X, y, train_size=0.5, random_state=0)%0A%0A    train_y_ohe = one_hot_encode_object_array(train_y)%0A    test_y_ohe = one_hot_encode_object_array(test_y)%0A%0A    model = Sequential()%0A    model.add(Dense(16, input_shape=(4, )))%0A    model.add(Activation('sigmoid'))%0A%0A    model.add(Dense(3))%0A    model.add(Activation('softmax'))%0A%0A    model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=%5B'accuracy'%5D)%0A    model.fit(train_X, train_y_ohe, nb_epoch=100, batch_size=1, verbose=0)%0A    loss, accuracy = model.evaluate(test_X, test_y_ohe, verbose=0)%0A    print(%22Accuracy (Multi-layer perceptron) = %7B:.2f%7D%22.format(accuracy))%0A%0Aif __name__ == %22__main__%22:%0A    iris_sklearn()%0A    iris_keras()%0A

Add iris_tutorial