diff --git a/baselines/.ipynb_checkpoints/MNIST_baseline-checkpoint.ipynb b/baselines/.ipynb_checkpoints/MNIST_baseline-checkpoint.ipynb index 58d307ae162a86fa6bdae50dab42a7cb8dcb8866..f7045c6dac50b106f3387a8e4ba985d7a56eb66c 100644 --- a/baselines/.ipynb_checkpoints/MNIST_baseline-checkpoint.ipynb +++ b/baselines/.ipynb_checkpoints/MNIST_baseline-checkpoint.ipynb @@ -142,23 +142,9 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": true - }, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'train_test_split' is not defined", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m<ipython-input-1-a7c485c3cf8f>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mX_train\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mX_val\u001b[0m\u001b[0;34m=\u001b[0m \u001b[0mtrain_test_split\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtrain_data\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtest_size\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0.2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrandom_state\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m42\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mNameError\u001b[0m: name 'train_test_split' is not defined" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "X_train, X_val= train_test_split(train_data, test_size=0.2, random_state=42) " ] @@ -263,7 +249,7 @@ "metadata": {}, "outputs": [], "source": [ - "y_pred = classifier.predict(X_test)" + "y_pred = classifier.predict(X_val)" ] }, { @@ -277,7 +263,7 @@ }, { "cell_type": "code", - "execution_count": 115, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -289,20 +275,9 @@ }, { "cell_type": "code", - "execution_count": 116, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Accuracy of the model is : 0.89356210142727\n", - "Recall of the model is : 0.89356210142727\n", - "Precision of the model is : 0.89356210142727\n", - "F1 score of the model is : 0.6058161925441079\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "print(\"Accuracy of the model is :\" ,accuracy)\n", "print(\"Recall of the model is :\" ,recall)\n", @@ -325,10 +300,10 @@ "source": [ "import matplotlib.pyplot as plt\n", "def correctly_predicted():\n", - " correct_pred = np.where(y_pred == y_test)\n", + " correct_pred = np.where(y_pred == y_val)\n", " fig = plt.figure()\n", " for i in range(1,10):\n", - " img = X_test.iloc[i,:]\n", + " img = X_val.iloc[i,:]\n", " img = np.array(img).reshape(28,28)\n", " fig.add_subplot(3,3,i)\n", " plt.imshow(img,cmap='gray')\n", @@ -352,12 +327,12 @@ }, { "cell_type": "code", - "execution_count": 117, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "final_test_path = \"test.csv\"\n", - "final_test = pd.read_csv(final_test_path)" + "final_test = pd.read_csv(final_test_path,header=None)" ] }, { diff --git a/baselines/MNIST_baseline.ipynb b/baselines/MNIST_baseline.ipynb index 58d307ae162a86fa6bdae50dab42a7cb8dcb8866..f7045c6dac50b106f3387a8e4ba985d7a56eb66c 100644 --- a/baselines/MNIST_baseline.ipynb +++ b/baselines/MNIST_baseline.ipynb @@ -142,23 +142,9 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": true - }, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'train_test_split' is not defined", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m<ipython-input-1-a7c485c3cf8f>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mX_train\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mX_val\u001b[0m\u001b[0;34m=\u001b[0m \u001b[0mtrain_test_split\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtrain_data\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtest_size\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0.2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrandom_state\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m42\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;31mNameError\u001b[0m: name 'train_test_split' is not defined" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "X_train, X_val= train_test_split(train_data, test_size=0.2, random_state=42) " ] @@ -263,7 +249,7 @@ "metadata": {}, "outputs": [], "source": [ - "y_pred = classifier.predict(X_test)" + "y_pred = classifier.predict(X_val)" ] }, { @@ -277,7 +263,7 @@ }, { "cell_type": "code", - "execution_count": 115, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -289,20 +275,9 @@ }, { "cell_type": "code", - "execution_count": 116, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Accuracy of the model is : 0.89356210142727\n", - "Recall of the model is : 0.89356210142727\n", - "Precision of the model is : 0.89356210142727\n", - "F1 score of the model is : 0.6058161925441079\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "print(\"Accuracy of the model is :\" ,accuracy)\n", "print(\"Recall of the model is :\" ,recall)\n", @@ -325,10 +300,10 @@ "source": [ "import matplotlib.pyplot as plt\n", "def correctly_predicted():\n", - " correct_pred = np.where(y_pred == y_test)\n", + " correct_pred = np.where(y_pred == y_val)\n", " fig = plt.figure()\n", " for i in range(1,10):\n", - " img = X_test.iloc[i,:]\n", + " img = X_val.iloc[i,:]\n", " img = np.array(img).reshape(28,28)\n", " fig.add_subplot(3,3,i)\n", " plt.imshow(img,cmap='gray')\n", @@ -352,12 +327,12 @@ }, { "cell_type": "code", - "execution_count": 117, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "final_test_path = \"test.csv\"\n", - "final_test = pd.read_csv(final_test_path)" + "final_test = pd.read_csv(final_test_path,header=None)" ] }, {