-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClassifAI_ 7 - Kaggle DS (non-image)
1 lines (1 loc) · 27.6 KB
/
ClassifAI_ 7 - Kaggle DS (non-image)
1
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"ClassifAI: 7 - Kaggle DS (non-image)","provenance":[{"file_id":"1Fk8OC57-R7_K410eYAAse2HXC1QBeBqU","timestamp":1654020951017}],"collapsed_sections":[]},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"97Rl8khZzils","executionInfo":{"status":"ok","timestamp":1636923941909,"user_tz":480,"elapsed":4925,"user":{"displayName":"Stephen Yang","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GgRF5l59s-mcNK95fI8XKVZTu62XguTTPb_5mL0=s64","userId":"10786061478342446437"}},"outputId":"290b677c-4c7a-42bd-c346-d6815af45543"},"source":["!pip install opendatasets"],"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Collecting opendatasets\n"," Downloading opendatasets-0.1.20-py3-none-any.whl (14 kB)\n","Requirement already satisfied: click in /usr/local/lib/python3.7/dist-packages (from opendatasets) (7.1.2)\n","Requirement already satisfied: kaggle in /usr/local/lib/python3.7/dist-packages (from opendatasets) (1.5.12)\n","Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from opendatasets) (4.62.3)\n","Requirement already satisfied: certifi in /usr/local/lib/python3.7/dist-packages (from kaggle->opendatasets) (2021.10.8)\n","Requirement already satisfied: python-slugify in /usr/local/lib/python3.7/dist-packages (from kaggle->opendatasets) (5.0.2)\n","Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from kaggle->opendatasets) (2.23.0)\n","Requirement already satisfied: urllib3 in /usr/local/lib/python3.7/dist-packages (from kaggle->opendatasets) (1.24.3)\n","Requirement already satisfied: python-dateutil in /usr/local/lib/python3.7/dist-packages (from kaggle->opendatasets) (2.8.2)\n","Requirement already satisfied: six>=1.10 in /usr/local/lib/python3.7/dist-packages (from kaggle->opendatasets) (1.15.0)\n","Requirement already satisfied: text-unidecode>=1.3 in /usr/local/lib/python3.7/dist-packages (from python-slugify->kaggle->opendatasets) (1.3)\n","Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->kaggle->opendatasets) (2.10)\n","Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->kaggle->opendatasets) (3.0.4)\n","Installing collected packages: opendatasets\n","Successfully installed opendatasets-0.1.20\n"]}]},{"cell_type":"code","metadata":{"id":"BevjvaydzqII"},"source":["import opendatasets as od\n","import pandas as pd\n","import numpy as np\n","import matplotlib.pyplot as plt\n","\n","# Tensorflow\n","import tensorflow as tf\n","from tensorflow.keras import callbacks\n","from tensorflow.keras import Sequential\n","from tensorflow.keras.layers import Dense\n","from tensorflow.keras.layers import Dropout\n","from sklearn.model_selection import train_test_split\n","from sklearn.preprocessing import StandardScaler\n","from tensorflow import keras\n"],"execution_count":null,"outputs":[]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"ttjBJ_V_ztyo","executionInfo":{"status":"ok","timestamp":1636924742859,"user_tz":480,"elapsed":11829,"user":{"displayName":"Stephen Yang","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GgRF5l59s-mcNK95fI8XKVZTu62XguTTPb_5mL0=s64","userId":"10786061478342446437"}},"outputId":"8aa49830-0408-44db-e659-09fb3b2a9713"},"source":["od.download(\"https://www.kaggle.com/rashikrahmanpritom/heart-attack-analysis-prediction-dataset\")\n"],"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Please provide your Kaggle credentials to download this dataset. Learn more: http://bit.ly/kaggle-creds\n","Your Kaggle username: stephenkyang\n","Your Kaggle Key: ··········\n","Downloading heart-attack-analysis-prediction-dataset.zip to ./heart-attack-analysis-prediction-dataset\n"]},{"output_type":"stream","name":"stderr","text":["100%|██████████| 4.11k/4.11k [00:00<00:00, 2.13MB/s]"]},{"output_type":"stream","name":"stdout","text":["\n"]},{"output_type":"stream","name":"stderr","text":["\n"]}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"rSz6ixSg0JBk","executionInfo":{"status":"ok","timestamp":1636924751377,"user_tz":480,"elapsed":171,"user":{"displayName":"Stephen Yang","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GgRF5l59s-mcNK95fI8XKVZTu62XguTTPb_5mL0=s64","userId":"10786061478342446437"}},"outputId":"8e4f1b7c-3e2b-48c3-e910-69df670d487b"},"source":["ls"],"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["\u001b[0m\u001b[01;34mheart-attack-analysis-prediction-dataset\u001b[0m/ heart.csv o2Saturation.csv\n"]}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"zSOWoejb2Uvp","executionInfo":{"status":"ok","timestamp":1636924763982,"user_tz":480,"elapsed":355,"user":{"displayName":"Stephen Yang","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GgRF5l59s-mcNK95fI8XKVZTu62XguTTPb_5mL0=s64","userId":"10786061478342446437"}},"outputId":"856560b7-eae0-4d7c-fecf-4ff291b0b0c7"},"source":["cd heart-attack-analysis-prediction-dataset/ "],"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["/content/heart-attack-analysis-prediction-dataset/heart-attack-analysis-prediction-dataset\n"]}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"xywd9x6y2WHb","executionInfo":{"status":"ok","timestamp":1636924765039,"user_tz":480,"elapsed":335,"user":{"displayName":"Stephen Yang","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GgRF5l59s-mcNK95fI8XKVZTu62XguTTPb_5mL0=s64","userId":"10786061478342446437"}},"outputId":"e4308a7d-939a-442b-cf70-2889c5f5d887"},"source":["ls"],"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["heart.csv o2Saturation.csv\n"]}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":204},"id":"yf7RULoe10Jw","executionInfo":{"status":"ok","timestamp":1636924009767,"user_tz":480,"elapsed":171,"user":{"displayName":"Stephen Yang","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GgRF5l59s-mcNK95fI8XKVZTu62XguTTPb_5mL0=s64","userId":"10786061478342446437"}},"outputId":"15bd1d08-d95d-4109-f4ae-37396a325a13"},"source":["df = pd.read_csv(\"heart.csv\")\n","\n","df.head()"],"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n"," .dataframe tbody tr th:only-of-type {\n"," vertical-align: middle;\n"," }\n","\n"," .dataframe tbody tr th {\n"," vertical-align: top;\n"," }\n","\n"," .dataframe thead th {\n"," text-align: right;\n"," }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n"," <thead>\n"," <tr style=\"text-align: right;\">\n"," <th></th>\n"," <th>age</th>\n"," <th>sex</th>\n"," <th>cp</th>\n"," <th>trtbps</th>\n"," <th>chol</th>\n"," <th>fbs</th>\n"," <th>restecg</th>\n"," <th>thalachh</th>\n"," <th>exng</th>\n"," <th>oldpeak</th>\n"," <th>slp</th>\n"," <th>caa</th>\n"," <th>thall</th>\n"," <th>output</th>\n"," </tr>\n"," </thead>\n"," <tbody>\n"," <tr>\n"," <th>0</th>\n"," <td>63</td>\n"," <td>1</td>\n"," <td>3</td>\n"," <td>145</td>\n"," <td>233</td>\n"," <td>1</td>\n"," <td>0</td>\n"," <td>150</td>\n"," <td>0</td>\n"," <td>2.3</td>\n"," <td>0</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>1</td>\n"," </tr>\n"," <tr>\n"," <th>1</th>\n"," <td>37</td>\n"," <td>1</td>\n"," <td>2</td>\n"," <td>130</td>\n"," <td>250</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>187</td>\n"," <td>0</td>\n"," <td>3.5</td>\n"," <td>0</td>\n"," <td>0</td>\n"," <td>2</td>\n"," <td>1</td>\n"," </tr>\n"," <tr>\n"," <th>2</th>\n"," <td>41</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>130</td>\n"," <td>204</td>\n"," <td>0</td>\n"," <td>0</td>\n"," <td>172</td>\n"," <td>0</td>\n"," <td>1.4</td>\n"," <td>2</td>\n"," <td>0</td>\n"," <td>2</td>\n"," <td>1</td>\n"," </tr>\n"," <tr>\n"," <th>3</th>\n"," <td>56</td>\n"," <td>1</td>\n"," <td>1</td>\n"," <td>120</td>\n"," <td>236</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>178</td>\n"," <td>0</td>\n"," <td>0.8</td>\n"," <td>2</td>\n"," <td>0</td>\n"," <td>2</td>\n"," <td>1</td>\n"," </tr>\n"," <tr>\n"," <th>4</th>\n"," <td>57</td>\n"," <td>0</td>\n"," <td>0</td>\n"," <td>120</td>\n"," <td>354</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>163</td>\n"," <td>1</td>\n"," <td>0.6</td>\n"," <td>2</td>\n"," <td>0</td>\n"," <td>2</td>\n"," <td>1</td>\n"," </tr>\n"," </tbody>\n","</table>\n","</div>"],"text/plain":[" age sex cp trtbps chol fbs ... exng oldpeak slp caa thall output\n","0 63 1 3 145 233 1 ... 0 2.3 0 0 1 1\n","1 37 1 2 130 250 0 ... 0 3.5 0 0 2 1\n","2 41 0 1 130 204 0 ... 0 1.4 2 0 2 1\n","3 56 1 1 120 236 0 ... 0 0.8 2 0 2 1\n","4 57 0 0 120 354 0 ... 1 0.6 2 0 2 1\n","\n","[5 rows x 14 columns]"]},"metadata":{},"execution_count":7}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"4mWdvYRGmCyy","executionInfo":{"status":"ok","timestamp":1636924009768,"user_tz":480,"elapsed":16,"user":{"displayName":"Stephen Yang","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GgRF5l59s-mcNK95fI8XKVZTu62XguTTPb_5mL0=s64","userId":"10786061478342446437"}},"outputId":"0fdf1500-03a4-4185-e6e0-a42688a99f97"},"source":["df.shape"],"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["(303, 14)"]},"metadata":{},"execution_count":8}]},{"cell_type":"code","metadata":{"id":"Jpn__xSE4uru"},"source":["#TODO (Not for this specific one but for your model)\n","\n","#How do I split the data into training and testing data?\n","#What are the number of classes?\n","#What are the input variables?"],"execution_count":null,"outputs":[]},{"cell_type":"code","metadata":{"id":"sZdxn17ahc0h"},"source":["X = df.drop(['output'], axis=1)\n","y = df['output']"],"execution_count":null,"outputs":[]},{"cell_type":"code","metadata":{"id":"MjuY-5O0h_D-"},"source":["X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)"],"execution_count":null,"outputs":[]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":419},"id":"nT8cjD32h_e5","executionInfo":{"status":"ok","timestamp":1636924009921,"user_tz":480,"elapsed":166,"user":{"displayName":"Stephen Yang","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GgRF5l59s-mcNK95fI8XKVZTu62XguTTPb_5mL0=s64","userId":"10786061478342446437"}},"outputId":"a615cf01-93ef-48ef-9665-6e222ff210a2"},"source":["X_train"],"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/html":["<div>\n","<style scoped>\n"," .dataframe tbody tr th:only-of-type {\n"," vertical-align: middle;\n"," }\n","\n"," .dataframe tbody tr th {\n"," vertical-align: top;\n"," }\n","\n"," .dataframe thead th {\n"," text-align: right;\n"," }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n"," <thead>\n"," <tr style=\"text-align: right;\">\n"," <th></th>\n"," <th>age</th>\n"," <th>sex</th>\n"," <th>cp</th>\n"," <th>trtbps</th>\n"," <th>chol</th>\n"," <th>fbs</th>\n"," <th>restecg</th>\n"," <th>thalachh</th>\n"," <th>exng</th>\n"," <th>oldpeak</th>\n"," <th>slp</th>\n"," <th>caa</th>\n"," <th>thall</th>\n"," </tr>\n"," </thead>\n"," <tbody>\n"," <tr>\n"," <th>132</th>\n"," <td>42</td>\n"," <td>1</td>\n"," <td>1</td>\n"," <td>120</td>\n"," <td>295</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>162</td>\n"," <td>0</td>\n"," <td>0.0</td>\n"," <td>2</td>\n"," <td>0</td>\n"," <td>2</td>\n"," </tr>\n"," <tr>\n"," <th>202</th>\n"," <td>58</td>\n"," <td>1</td>\n"," <td>0</td>\n"," <td>150</td>\n"," <td>270</td>\n"," <td>0</td>\n"," <td>0</td>\n"," <td>111</td>\n"," <td>1</td>\n"," <td>0.8</td>\n"," <td>2</td>\n"," <td>0</td>\n"," <td>3</td>\n"," </tr>\n"," <tr>\n"," <th>196</th>\n"," <td>46</td>\n"," <td>1</td>\n"," <td>2</td>\n"," <td>150</td>\n"," <td>231</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>147</td>\n"," <td>0</td>\n"," <td>3.6</td>\n"," <td>1</td>\n"," <td>0</td>\n"," <td>2</td>\n"," </tr>\n"," <tr>\n"," <th>75</th>\n"," <td>55</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>135</td>\n"," <td>250</td>\n"," <td>0</td>\n"," <td>0</td>\n"," <td>161</td>\n"," <td>0</td>\n"," <td>1.4</td>\n"," <td>1</td>\n"," <td>0</td>\n"," <td>2</td>\n"," </tr>\n"," <tr>\n"," <th>176</th>\n"," <td>60</td>\n"," <td>1</td>\n"," <td>0</td>\n"," <td>117</td>\n"," <td>230</td>\n"," <td>1</td>\n"," <td>1</td>\n"," <td>160</td>\n"," <td>1</td>\n"," <td>1.4</td>\n"," <td>2</td>\n"," <td>2</td>\n"," <td>3</td>\n"," </tr>\n"," <tr>\n"," <th>...</th>\n"," <td>...</td>\n"," <td>...</td>\n"," <td>...</td>\n"," <td>...</td>\n"," <td>...</td>\n"," <td>...</td>\n"," <td>...</td>\n"," <td>...</td>\n"," <td>...</td>\n"," <td>...</td>\n"," <td>...</td>\n"," <td>...</td>\n"," <td>...</td>\n"," </tr>\n"," <tr>\n"," <th>188</th>\n"," <td>50</td>\n"," <td>1</td>\n"," <td>2</td>\n"," <td>140</td>\n"," <td>233</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>163</td>\n"," <td>0</td>\n"," <td>0.6</td>\n"," <td>1</td>\n"," <td>1</td>\n"," <td>3</td>\n"," </tr>\n"," <tr>\n"," <th>71</th>\n"," <td>51</td>\n"," <td>1</td>\n"," <td>2</td>\n"," <td>94</td>\n"," <td>227</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>154</td>\n"," <td>1</td>\n"," <td>0.0</td>\n"," <td>2</td>\n"," <td>1</td>\n"," <td>3</td>\n"," </tr>\n"," <tr>\n"," <th>106</th>\n"," <td>69</td>\n"," <td>1</td>\n"," <td>3</td>\n"," <td>160</td>\n"," <td>234</td>\n"," <td>1</td>\n"," <td>0</td>\n"," <td>131</td>\n"," <td>0</td>\n"," <td>0.1</td>\n"," <td>1</td>\n"," <td>1</td>\n"," <td>2</td>\n"," </tr>\n"," <tr>\n"," <th>270</th>\n"," <td>46</td>\n"," <td>1</td>\n"," <td>0</td>\n"," <td>120</td>\n"," <td>249</td>\n"," <td>0</td>\n"," <td>0</td>\n"," <td>144</td>\n"," <td>0</td>\n"," <td>0.8</td>\n"," <td>2</td>\n"," <td>0</td>\n"," <td>3</td>\n"," </tr>\n"," <tr>\n"," <th>102</th>\n"," <td>63</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>140</td>\n"," <td>195</td>\n"," <td>0</td>\n"," <td>1</td>\n"," <td>179</td>\n"," <td>0</td>\n"," <td>0.0</td>\n"," <td>2</td>\n"," <td>2</td>\n"," <td>2</td>\n"," </tr>\n"," </tbody>\n","</table>\n","<p>242 rows × 13 columns</p>\n","</div>"],"text/plain":[" age sex cp trtbps chol fbs ... thalachh exng oldpeak slp caa thall\n","132 42 1 1 120 295 0 ... 162 0 0.0 2 0 2\n","202 58 1 0 150 270 0 ... 111 1 0.8 2 0 3\n","196 46 1 2 150 231 0 ... 147 0 3.6 1 0 2\n","75 55 0 1 135 250 0 ... 161 0 1.4 1 0 2\n","176 60 1 0 117 230 1 ... 160 1 1.4 2 2 3\n",".. ... ... .. ... ... ... ... ... ... ... ... ... ...\n","188 50 1 2 140 233 0 ... 163 0 0.6 1 1 3\n","71 51 1 2 94 227 0 ... 154 1 0.0 2 1 3\n","106 69 1 3 160 234 1 ... 131 0 0.1 1 1 2\n","270 46 1 0 120 249 0 ... 144 0 0.8 2 0 3\n","102 63 0 1 140 195 0 ... 179 0 0.0 2 2 2\n","\n","[242 rows x 13 columns]"]},"metadata":{},"execution_count":12}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"i9mvMA9Kkukv","executionInfo":{"status":"ok","timestamp":1636924009922,"user_tz":480,"elapsed":5,"user":{"displayName":"Stephen Yang","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GgRF5l59s-mcNK95fI8XKVZTu62XguTTPb_5mL0=s64","userId":"10786061478342446437"}},"outputId":"0ed117e5-a6cc-41ce-994a-6309ab5f85b9"},"source":["y_train"],"execution_count":null,"outputs":[{"output_type":"execute_result","data":{"text/plain":["132 1\n","202 0\n","196 0\n","75 1\n","176 0\n"," ..\n","188 0\n","71 1\n","106 1\n","270 0\n","102 1\n","Name: output, Length: 242, dtype: int64"]},"metadata":{},"execution_count":13}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"r3C84qaunMHg","executionInfo":{"status":"ok","timestamp":1636924017618,"user_tz":480,"elapsed":7699,"user":{"displayName":"Stephen Yang","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GgRF5l59s-mcNK95fI8XKVZTu62XguTTPb_5mL0=s64","userId":"10786061478342446437"}},"outputId":"0991420b-261e-4a87-ec1d-e5d88df73e59"},"source":["model = keras.Sequential(\n"," [\n"," keras.layers.Dense(256, activation=\"relu\", input_shape=[13]),\n"," keras.layers.Dense(515, activation=\"relu\"),\n"," keras.layers.Dropout(0.3), #randomly sets value to 0 to prevent over fitting (usually for non image datasets)\n"," keras.layers.Dense(50, activation=\"relu\"),\n"," keras.layers.Dropout(0.3),\n"," keras.layers.Dense(1, activation=\"sigmoid\"),\n"," ]\n",")\n","\n","model.compile(optimizer = 'Adam', loss = 'binary_crossentropy', metrics = ['binary_accuracy'])\n","\n","early_stopping = keras.callbacks.EarlyStopping( patience = 20, min_delta = 0.001,\n"," restore_best_weights =True )\n","history = model.fit(\n"," X_train, y_train,\n"," validation_data=(X_test, y_test),\n"," batch_size=15,\n"," epochs=50,\n"," callbacks = [early_stopping],\n"," verbose=1, \n",")"],"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Epoch 1/50\n","17/17 [==============================] - 1s 19ms/step - loss: 6.1546 - binary_accuracy: 0.5124 - val_loss: 1.5828 - val_binary_accuracy: 0.5410\n","Epoch 2/50\n","17/17 [==============================] - 0s 7ms/step - loss: 2.4314 - binary_accuracy: 0.4917 - val_loss: 0.7554 - val_binary_accuracy: 0.5082\n","Epoch 3/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.9838 - binary_accuracy: 0.5248 - val_loss: 0.7229 - val_binary_accuracy: 0.5246\n","Epoch 4/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.7595 - binary_accuracy: 0.5124 - val_loss: 0.6916 - val_binary_accuracy: 0.5246\n","Epoch 5/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.7275 - binary_accuracy: 0.4752 - val_loss: 0.6891 - val_binary_accuracy: 0.6066\n","Epoch 6/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.7046 - binary_accuracy: 0.5620 - val_loss: 0.6873 - val_binary_accuracy: 0.5246\n","Epoch 7/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6973 - binary_accuracy: 0.5579 - val_loss: 0.6868 - val_binary_accuracy: 0.5246\n","Epoch 8/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.7028 - binary_accuracy: 0.5537 - val_loss: 0.6904 - val_binary_accuracy: 0.6230\n","Epoch 9/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6944 - binary_accuracy: 0.5537 - val_loss: 0.6927 - val_binary_accuracy: 0.5246\n","Epoch 10/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6854 - binary_accuracy: 0.5331 - val_loss: 0.6927 - val_binary_accuracy: 0.5246\n","Epoch 11/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.7190 - binary_accuracy: 0.5620 - val_loss: 0.6860 - val_binary_accuracy: 0.5246\n","Epoch 12/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6964 - binary_accuracy: 0.5165 - val_loss: 0.6859 - val_binary_accuracy: 0.5246\n","Epoch 13/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.7019 - binary_accuracy: 0.5579 - val_loss: 0.6745 - val_binary_accuracy: 0.5246\n","Epoch 14/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.7418 - binary_accuracy: 0.5744 - val_loss: 0.6854 - val_binary_accuracy: 0.5246\n","Epoch 15/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6991 - binary_accuracy: 0.5496 - val_loss: 0.6832 - val_binary_accuracy: 0.5246\n","Epoch 16/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.7456 - binary_accuracy: 0.5661 - val_loss: 0.6866 - val_binary_accuracy: 0.5246\n","Epoch 17/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.7248 - binary_accuracy: 0.5372 - val_loss: 0.6801 - val_binary_accuracy: 0.5246\n","Epoch 18/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.7072 - binary_accuracy: 0.5661 - val_loss: 0.6714 - val_binary_accuracy: 0.5246\n","Epoch 19/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6846 - binary_accuracy: 0.5744 - val_loss: 0.6753 - val_binary_accuracy: 0.5246\n","Epoch 20/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.7320 - binary_accuracy: 0.5455 - val_loss: 0.6895 - val_binary_accuracy: 0.5246\n","Epoch 21/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6976 - binary_accuracy: 0.5331 - val_loss: 0.6913 - val_binary_accuracy: 0.5246\n","Epoch 22/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6788 - binary_accuracy: 0.5579 - val_loss: 0.6874 - val_binary_accuracy: 0.5246\n","Epoch 23/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6998 - binary_accuracy: 0.5579 - val_loss: 0.6789 - val_binary_accuracy: 0.5246\n","Epoch 24/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6897 - binary_accuracy: 0.5372 - val_loss: 0.6778 - val_binary_accuracy: 0.5246\n","Epoch 25/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6814 - binary_accuracy: 0.5413 - val_loss: 0.6773 - val_binary_accuracy: 0.5246\n","Epoch 26/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6917 - binary_accuracy: 0.5661 - val_loss: 0.6727 - val_binary_accuracy: 0.5246\n","Epoch 27/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6858 - binary_accuracy: 0.5372 - val_loss: 0.6650 - val_binary_accuracy: 0.5246\n","Epoch 28/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6854 - binary_accuracy: 0.5496 - val_loss: 0.6587 - val_binary_accuracy: 0.5246\n","Epoch 29/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6737 - binary_accuracy: 0.5868 - val_loss: 0.6594 - val_binary_accuracy: 0.5410\n","Epoch 30/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6815 - binary_accuracy: 0.5041 - val_loss: 0.6537 - val_binary_accuracy: 0.5246\n","Epoch 31/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6924 - binary_accuracy: 0.5579 - val_loss: 0.6549 - val_binary_accuracy: 0.5246\n","Epoch 32/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6698 - binary_accuracy: 0.5496 - val_loss: 0.6498 - val_binary_accuracy: 0.5246\n","Epoch 33/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6935 - binary_accuracy: 0.5413 - val_loss: 0.6787 - val_binary_accuracy: 0.5246\n","Epoch 34/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6702 - binary_accuracy: 0.5579 - val_loss: 0.6403 - val_binary_accuracy: 0.5246\n","Epoch 35/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6783 - binary_accuracy: 0.5537 - val_loss: 0.6418 - val_binary_accuracy: 0.5246\n","Epoch 36/50\n","17/17 [==============================] - 0s 8ms/step - loss: 0.6748 - binary_accuracy: 0.5537 - val_loss: 0.6656 - val_binary_accuracy: 0.5246\n","Epoch 37/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6674 - binary_accuracy: 0.5620 - val_loss: 0.6303 - val_binary_accuracy: 0.5246\n","Epoch 38/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6895 - binary_accuracy: 0.5702 - val_loss: 0.6382 - val_binary_accuracy: 0.7541\n","Epoch 39/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6732 - binary_accuracy: 0.5702 - val_loss: 0.6082 - val_binary_accuracy: 0.6557\n","Epoch 40/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6588 - binary_accuracy: 0.5496 - val_loss: 0.6065 - val_binary_accuracy: 0.7049\n","Epoch 41/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6430 - binary_accuracy: 0.5702 - val_loss: 0.5999 - val_binary_accuracy: 0.7705\n","Epoch 42/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6603 - binary_accuracy: 0.5785 - val_loss: 0.6014 - val_binary_accuracy: 0.7705\n","Epoch 43/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6567 - binary_accuracy: 0.6322 - val_loss: 0.5776 - val_binary_accuracy: 0.6885\n","Epoch 44/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6916 - binary_accuracy: 0.5826 - val_loss: 0.6388 - val_binary_accuracy: 0.5574\n","Epoch 45/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6630 - binary_accuracy: 0.5950 - val_loss: 0.6265 - val_binary_accuracy: 0.8033\n","Epoch 46/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6392 - binary_accuracy: 0.6157 - val_loss: 0.5693 - val_binary_accuracy: 0.8197\n","Epoch 47/50\n","17/17 [==============================] - 0s 9ms/step - loss: 0.6777 - binary_accuracy: 0.5537 - val_loss: 0.5949 - val_binary_accuracy: 0.6230\n","Epoch 48/50\n","17/17 [==============================] - 0s 7ms/step - loss: 0.6417 - binary_accuracy: 0.5950 - val_loss: 0.5960 - val_binary_accuracy: 0.7869\n","Epoch 49/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6470 - binary_accuracy: 0.6405 - val_loss: 0.5463 - val_binary_accuracy: 0.8197\n","Epoch 50/50\n","17/17 [==============================] - 0s 6ms/step - loss: 0.6263 - binary_accuracy: 0.6198 - val_loss: 0.5283 - val_binary_accuracy: 0.8197\n"]}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"9UweW9Kynn1o","executionInfo":{"status":"ok","timestamp":1636924017862,"user_tz":480,"elapsed":255,"user":{"displayName":"Stephen Yang","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GgRF5l59s-mcNK95fI8XKVZTu62XguTTPb_5mL0=s64","userId":"10786061478342446437"}},"outputId":"191c3c5b-ef02-4326-a8a1-505d151a1cc6"},"source":["test_loss, test_acc = model.evaluate(X_test, y_test)\n","\n","print('Test accuracy:', test_acc)"],"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["2/2 [==============================] - 0s 7ms/step - loss: 0.5283 - binary_accuracy: 0.8197\n","Test accuracy: 0.8196721076965332\n"]}]}]}