diff --git a/Challenge 2_spiral output_Final.png b/Challenge 2_spiral output_Final.png new file mode 100644 index 0000000..c066aeb Binary files /dev/null and b/Challenge 2_spiral output_Final.png differ diff --git a/your-code/challenge-1.ipynb b/your-code/challenge-1.ipynb index 2487c5f..dfd17c8 100644 --- a/your-code/challenge-1.ipynb +++ b/your-code/challenge-1.ipynb @@ -34,11 +34,116 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " TL TM TR ML MM MR BL BM BR class\n", + "0 x x x x o o x o o True\n", + "1 x x x x o o o x o True\n", + "2 x x x x o o o o x True\n", + "3 x x x x o o o b b True\n", + "4 x x x x o o b o b True\n", + "(958, 10)\n", + "TL 0\n", + "TM 0\n", + "TR 0\n", + "ML 0\n", + "MM 0\n", + "MR 0\n", + "BL 0\n", + "BM 0\n", + "BR 0\n", + "class 0\n", + "dtype: int64\n" + ] + } + ], + "source": [ + "# your code here\n", + "\n", + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "tic = pd.read_csv(\"tic-tac-toe.csv\")\n", + "\n", + "print(tic.head())\n", + "print(tic.shape)\n", + "print(tic.isnull().sum())\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " TL TM TR ML MM MR BL BM BR\n", + "0 x x x x o o x o o\n", + "1 x x x x o o o x o\n", + "2 x x x x o o o o x\n", + "3 x x x x o o o b b\n", + "4 x x x x o o b o b\n", + "0 1\n", + "1 1\n", + "2 1\n", + "3 1\n", + "4 1\n", + "Name: class, dtype: int32\n", + " TL TM TR ML MM MR BL BM BR\n", + "0 1 1 1 1 0 0 1 0 0\n", + "1 1 1 1 1 0 0 0 1 0\n", + "2 1 1 1 1 0 0 0 0 1\n", + "3 1 1 1 1 0 0 0 2 2\n", + "4 1 1 1 1 0 0 2 0 2\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\KK\\AppData\\Local\\Temp\\ipykernel_14608\\2294999656.py:6: FutureWarning: Downcasting behavior in `replace` is deprecated and will be removed in a future version. To retain the old behavior, explicitly call `result.infer_objects(copy=False)`. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`\n", + " tic_pred_encoded = tic_predictors.replace({'x': 1, 'o': 0, 'b': 2})\n" + ] + } + ], + "source": [ + "#Split into Predictors and target\n", + "\n", + "# Need to Encode both the Predictor and target using One-Hot Encoding. \n", + "\n", + "tic_predictors = tic.drop(columns = [\"class\"])\n", + "tic_pred_encoded = tic_predictors.replace({'x': 1, 'o': 0, 'b': 2})\n", + "\n", + "tic_tgt_encoded = tic['class'].astype(int)\n", + "\n", + "print(tic_predictors.head())\n", + "print(tic_tgt_encoded.head())\n", + "print(tic_pred_encoded.head())\n" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "9\n" + ] + } + ], "source": [ - "# your code here" + "n_cols = tic_predictors.shape[1]\n", + "print(n_cols)" ] }, { @@ -60,11 +165,195 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "# your code here\n", + "\n", + "#!pip install tensorflow\n", + "from tensorflow import keras\n", + "\n", + "from keras.models import Sequential\n", + "from keras.layers import Dense\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [], + "source": [ + "from sklearn.model_selection import train_test_split\n", + "\n", + "# Split the Train and Test Data\n", + "X_train, X_test, y_train, y_test = train_test_split(tic_pred_encoded,tic_tgt_encoded,test_size=0.2, random_state = 42)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "# Define a Sequential Model\n", + "def sequential_model():\n", + " #create model\n", + " model = Sequential()\n", + " model.add(Dense(64, activation= 'relu', input_shape=(n_cols,)))\n", + " model.add(Dense(32, activation= 'relu'))\n", + " model.add(Dense(16, activation= 'relu'))\n", + " model.add(Dense(2, activation='softmax')) # Output Layer \n", + "\n", + " #compile model\n", + " model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics = ['accuracy'])\n", + " return model" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "c:\\Users\\KK\\anaconda3\\Lib\\site-packages\\keras\\src\\layers\\core\\dense.py:87: UserWarning: Do not pass an `input_shape`/`input_dim` argument to a layer. When using Sequential models, prefer using an `Input(shape)` object as the first layer in the model instead.\n", + " super().__init__(activity_regularizer=activity_regularizer, **kwargs)\n" + ] + } + ], + "source": [ + "# Build the Model\n", + "model = sequential_model()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Epoch 1/50\n", + "24/24 - 4s - 156ms/step - accuracy: 0.6540 - loss: 0.6462\n", + "Epoch 2/50\n", + "24/24 - 0s - 8ms/step - accuracy: 0.6540 - loss: 0.6143\n", + "Epoch 3/50\n", + "24/24 - 0s - 8ms/step - accuracy: 0.6580 - loss: 0.5911\n", + "Epoch 4/50\n", + "24/24 - 0s - 6ms/step - accuracy: 0.6815 - loss: 0.5689\n", + "Epoch 5/50\n", + "24/24 - 0s - 9ms/step - accuracy: 0.6945 - loss: 0.5459\n", + "Epoch 6/50\n", + "24/24 - 0s - 6ms/step - accuracy: 0.7337 - loss: 0.5172\n", + "Epoch 7/50\n", + "24/24 - 0s - 5ms/step - accuracy: 0.7663 - loss: 0.4839\n", + "Epoch 8/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.7663 - loss: 0.4542\n", + "Epoch 9/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.8460 - loss: 0.4035\n", + "Epoch 10/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.8838 - loss: 0.3632\n", + "Epoch 11/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9099 - loss: 0.3251\n", + "Epoch 12/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9204 - loss: 0.2899\n", + "Epoch 13/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9347 - loss: 0.2533\n", + "Epoch 14/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9569 - loss: 0.2223\n", + "Epoch 15/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9543 - loss: 0.1969\n", + "Epoch 16/50\n", + "24/24 - 0s - 7ms/step - accuracy: 0.9713 - loss: 0.1764\n", + "Epoch 17/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9634 - loss: 0.1592\n", + "Epoch 18/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9674 - loss: 0.1459\n", + "Epoch 19/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9778 - loss: 0.1227\n", + "Epoch 20/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9778 - loss: 0.1125\n", + "Epoch 21/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9804 - loss: 0.1050\n", + "Epoch 22/50\n", + "24/24 - 0s - 6ms/step - accuracy: 0.9817 - loss: 0.0977\n", + "Epoch 23/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9843 - loss: 0.0878\n", + "Epoch 24/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9856 - loss: 0.0820\n", + "Epoch 25/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9817 - loss: 0.0777\n", + "Epoch 26/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9856 - loss: 0.0727\n", + "Epoch 27/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9856 - loss: 0.0672\n", + "Epoch 28/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9817 - loss: 0.0660\n", + "Epoch 29/50\n", + "24/24 - 0s - 6ms/step - accuracy: 0.9856 - loss: 0.0592\n", + "Epoch 30/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9830 - loss: 0.0564\n", + "Epoch 31/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9843 - loss: 0.0532\n", + "Epoch 32/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9869 - loss: 0.0483\n", + "Epoch 33/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9856 - loss: 0.0511\n", + "Epoch 34/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9830 - loss: 0.0449\n", + "Epoch 35/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9856 - loss: 0.0432\n", + "Epoch 36/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9869 - loss: 0.0384\n", + "Epoch 37/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9869 - loss: 0.0364\n", + "Epoch 38/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9883 - loss: 0.0368\n", + "Epoch 39/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9922 - loss: 0.0294\n", + "Epoch 40/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9896 - loss: 0.0290\n", + "Epoch 41/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9896 - loss: 0.0287\n", + "Epoch 42/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9909 - loss: 0.0272\n", + "Epoch 43/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9935 - loss: 0.0274\n", + "Epoch 44/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9922 - loss: 0.0247\n", + "Epoch 45/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9974 - loss: 0.0212\n", + "Epoch 46/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9974 - loss: 0.0194\n", + "Epoch 47/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9974 - loss: 0.0189\n", + "Epoch 48/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9948 - loss: 0.0187\n", + "Epoch 49/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9987 - loss: 0.0187\n", + "Epoch 50/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9961 - loss: 0.0176\n" + ] + }, + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Fit the Model\n", + "model.fit(X_train, y_train, epochs=50, verbose=2)" ] }, { @@ -78,11 +367,52 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[1m6/6\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 1ms/step \n", + "\n", + "\n" + ] + } + ], + "source": [ + "# your code here\n", + "\n", + "# Make Predictions\n", + "y_pred = model.predict(X_test)\n", + "\n", + "print(type(y_pred))\n", + "print(type(y_test))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "' from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score\\n\\nprint(\"Accuracy:\", accuracy_score(y_test, y_pred))\\nprint(\"Precision:\", precision_score(y_test, y_pred))\\nprint(\"Recall:\", recall_score(y_test, y_pred))\\nprint(\"F1-Score:\", f1_score(y_test, y_pred)) '" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "\"\"\" from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score\n", + "\n", + "print(\"Accuracy:\", accuracy_score(y_test, y_pred))\n", + "print(\"Precision:\", precision_score(y_test, y_pred))\n", + "print(\"Recall:\", recall_score(y_test, y_pred))\n", + "print(\"F1-Score:\", f1_score(y_test, y_pred)) \"\"\"" ] }, { @@ -104,11 +434,173 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "# HOW TO IMPROVE THE MODEL!\n", + "\n", + "# Adjusting the LEARNING RATE for the model \n", + "\n", + "from tensorflow.keras.optimizers import Adam\n", + "\n", + "# Define customer learning rate\n", + "learning_rate = 0.01 \n", + "\n", + "#Create an instance of the Adam optimizer with the customer learning rate\n", + "learning_optimizer = Adam(learning_rate=learning_rate)\n", + "\n", + "# Define a Sequential Model\n", + "def sequential_model():\n", + " #create model\n", + " model = Sequential()\n", + " model.add(Dense(64, activation= 'relu', input_shape=(n_cols,)))\n", + " model.add(Dense(32, activation= 'relu'))\n", + " model.add(Dense(16, activation= 'relu'))\n", + " model.add(Dense(2, activation='softmax')) # Output Layer \n", + "\n", + " #compile model\n", + " model.compile(optimizer=learning_optimizer, loss='sparse_categorical_crossentropy', metrics = ['accuracy']) \n", + " return model\n" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "c:\\Users\\KK\\anaconda3\\Lib\\site-packages\\keras\\src\\layers\\core\\dense.py:87: UserWarning: Do not pass an `input_shape`/`input_dim` argument to a layer. When using Sequential models, prefer using an `Input(shape)` object as the first layer in the model instead.\n", + " super().__init__(activity_regularizer=activity_regularizer, **kwargs)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Epoch 1/50\n", + "24/24 - 2s - 102ms/step - accuracy: 0.6397 - loss: 0.6280\n", + "Epoch 2/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.6815 - loss: 0.5824\n", + "Epoch 3/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.7193 - loss: 0.5216\n", + "Epoch 4/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.8016 - loss: 0.4173\n", + "Epoch 5/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.8446 - loss: 0.3280\n", + "Epoch 6/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.8916 - loss: 0.2692\n", + "Epoch 7/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9360 - loss: 0.1865\n", + "Epoch 8/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9517 - loss: 0.1330\n", + "Epoch 9/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9595 - loss: 0.0996\n", + "Epoch 10/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9648 - loss: 0.0993\n", + "Epoch 11/50\n", + "24/24 - 0s - 7ms/step - accuracy: 0.9700 - loss: 0.0822\n", + "Epoch 12/50\n", + "24/24 - 0s - 2ms/step - accuracy: 0.9817 - loss: 0.0625\n", + "Epoch 13/50\n", + "24/24 - 0s - 3ms/step - accuracy: 0.9765 - loss: 0.0675\n", + "Epoch 14/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9843 - loss: 0.0495\n", + "Epoch 15/50\n", + "24/24 - 0s - 7ms/step - accuracy: 0.9856 - loss: 0.0404\n", + "Epoch 16/50\n", + "24/24 - 0s - 7ms/step - accuracy: 0.9869 - loss: 0.0405\n", + "Epoch 17/50\n", + "24/24 - 0s - 5ms/step - accuracy: 0.9843 - loss: 0.0386\n", + "Epoch 18/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9883 - loss: 0.0318\n", + "Epoch 19/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9922 - loss: 0.0218\n", + "Epoch 20/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9856 - loss: 0.0358\n", + "Epoch 21/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9869 - loss: 0.0293\n", + "Epoch 22/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9935 - loss: 0.0165\n", + "Epoch 23/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9909 - loss: 0.0201\n", + "Epoch 24/50\n", + "24/24 - 0s - 5ms/step - accuracy: 0.9856 - loss: 0.0341\n", + "Epoch 25/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9909 - loss: 0.0201\n", + "Epoch 26/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9961 - loss: 0.0113\n", + "Epoch 27/50\n", + "24/24 - 0s - 8ms/step - accuracy: 0.9948 - loss: 0.0143\n", + "Epoch 28/50\n", + "24/24 - 0s - 6ms/step - accuracy: 0.9961 - loss: 0.0080\n", + "Epoch 29/50\n", + "24/24 - 0s - 9ms/step - accuracy: 0.9987 - loss: 0.0068\n", + "Epoch 30/50\n", + "24/24 - 0s - 9ms/step - accuracy: 0.9961 - loss: 0.0099\n", + "Epoch 31/50\n", + "24/24 - 0s - 12ms/step - accuracy: 0.9582 - loss: 0.1370\n", + "Epoch 32/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9360 - loss: 0.1562\n", + "Epoch 33/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9817 - loss: 0.0537\n", + "Epoch 34/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9869 - loss: 0.0303\n", + "Epoch 35/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9896 - loss: 0.0238\n", + "Epoch 36/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9922 - loss: 0.0198\n", + "Epoch 37/50\n", + "24/24 - 0s - 8ms/step - accuracy: 0.9935 - loss: 0.0146\n", + "Epoch 38/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9961 - loss: 0.0115\n", + "Epoch 39/50\n", + "24/24 - 0s - 7ms/step - accuracy: 0.9987 - loss: 0.0069\n", + "Epoch 40/50\n", + "24/24 - 0s - 4ms/step - accuracy: 1.0000 - loss: 0.0041\n", + "Epoch 41/50\n", + "24/24 - 0s - 4ms/step - accuracy: 0.9987 - loss: 0.0035\n", + "Epoch 42/50\n", + "24/24 - 0s - 5ms/step - accuracy: 1.0000 - loss: 0.0018\n", + "Epoch 43/50\n", + "24/24 - 0s - 5ms/step - accuracy: 1.0000 - loss: 0.0012\n", + "Epoch 44/50\n", + "24/24 - 0s - 4ms/step - accuracy: 1.0000 - loss: 8.9957e-04\n", + "Epoch 45/50\n", + "24/24 - 0s - 4ms/step - accuracy: 1.0000 - loss: 7.5620e-04\n", + "Epoch 46/50\n", + "24/24 - 0s - 4ms/step - accuracy: 1.0000 - loss: 5.6278e-04\n", + "Epoch 47/50\n", + "24/24 - 0s - 4ms/step - accuracy: 1.0000 - loss: 4.6180e-04\n", + "Epoch 48/50\n", + "24/24 - 0s - 3ms/step - accuracy: 1.0000 - loss: 3.9259e-04\n", + "Epoch 49/50\n", + "24/24 - 0s - 4ms/step - accuracy: 1.0000 - loss: 3.3795e-04\n", + "Epoch 50/50\n", + "24/24 - 0s - 3ms/step - accuracy: 1.0000 - loss: 3.0256e-04\n", + "\u001b[1m6/6\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 2ms/step \n", + "Accuracy: 0.9739583333333334\n" + ] + } + ], + "source": [ + "# Build the Model\n", + "model = sequential_model()\n", + "\n", + "# Fit the Model\n", + "model.fit(X_train, y_train, epochs=50, verbose=2)\n", + "\n", + "# Make Predictions\n", + "y_pred = model.predict(X_test)\n", + "\n", + "from sklearn.metrics import accuracy_score\n", + "\n", + "y_pred_classes = np.argmax(y_pred, axis=1)\n", + "accuracy = accuracy_score(y_test, y_pred_classes)\n", + "print(f'Accuracy: {accuracy}')" ] }, { @@ -124,7 +616,20 @@ "metadata": {}, "outputs": [], "source": [ - "# your answer here" + "# your answer here\n", + "\n", + "# 1) Adding additional hidden layer - during Model definition\n", + "# 2) Increasing the neurons (Dense) in each layer - during Model definition\n", + "# 3) Defining the learning rate - during Model definition\n", + "# 4) Increasing the epochs - during Model Fit\n", + "\n", + "\n", + "# Check the above for Accuracy and Loss\n", + "\n", + "# Having epochs of 25 yields accuracy of 0.9491 and loss of 0.1955 \n", + "# Having epochs of 50 yields accuracy of 0.9883 and loss of 0.0484 \n", + "# Adding another layer and having epochs of 50 yields accuracy of 0.99873 and loss of 0.0135 /* Accuracy didn't improve any better after this!\n", + "# Defining the learning rate (as 0.01) improves the accuracy to 1 and brings down the Loss to almost zero. " ] } ], @@ -144,7 +649,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/your-code/challenge-2.md b/your-code/challenge-2.md index 9d98968..7e0dc65 100644 --- a/your-code/challenge-2.md +++ b/your-code/challenge-2.md @@ -17,12 +17,12 @@ Finally, using what you have learned, try tuning the hyperparameters for the spi ![spiral output](challenge-2.png) After you're done, submit a screenshot of your Playground including the following information: - -* Epoch -* Learning rate -* Activation function -* Features included -* Hidden layers and neurons -* Test and training loss +![Spiral Output](Challenge 2_spiral output_Final.png) +* Epoch - 5220 +* Learning rate - 0.03 +* Activation function - ReLU +* Features included - all 7 of them +* Hidden layers and neurons - 3 Hidden Layers with 6, 4, 2 Neurons respectively +* Test and training loss - Test Loss (0.034) and Training loss (0.015) **Do not google for the end solution!**