mpg/model.ipynb

1597 lines
2.4 MiB
Text
Raw Normal View History

2022-07-21 16:31:53 -04:00
{
"cells": [
{
"cell_type": "markdown",
"id": "717f94d3-edfa-4122-9902-212a3456bb8c",
"metadata": {},
"source": [
"[EDA](eda.ipynb)"
]
},
2022-08-01 11:39:46 -04:00
{
"cell_type": "markdown",
"id": "43c4fe12-eb94-434c-8808-15fd7cdcf17d",
"metadata": {},
"source": [
"# Modeling"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "c47122c5-bdcd-4b6b-8d22-8958ad910eca",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:27.108272Z",
"iopub.status.busy": "2022-08-01T14:49:27.107585Z",
"iopub.status.idle": "2022-08-01T14:49:28.795162Z",
"shell.execute_reply": "2022-08-01T14:49:28.794368Z",
"shell.execute_reply.started": "2022-08-01T14:49:27.108146Z"
},
"tags": []
},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"from sklearn.model_selection import train_test_split\n",
"from sklearn.pipeline import Pipeline\n",
"from sklearn.preprocessing import QuantileTransformer\n",
"from sklearn.linear_model import Ridge,Lasso,LinearRegression\n",
"from sklearn.tree import DecisionTreeRegressor\n",
"from sklearn.neighbors import KNeighborsRegressor\n",
"from sklearn.svm import LinearSVR\n",
"from sklearn.metrics import mean_squared_error,r2_score"
]
},
{
"cell_type": "markdown",
"id": "1cbc710d-f819-4200-9add-25bc699d8b46",
"metadata": {},
"source": [
"Load in the data"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "78f30ccd-7153-4d8e-9784-4dce46a46fb2",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:28.797832Z",
"iopub.status.busy": "2022-08-01T14:49:28.797191Z",
"iopub.status.idle": "2022-08-01T14:49:28.858368Z",
"shell.execute_reply": "2022-08-01T14:49:28.857624Z",
"shell.execute_reply.started": "2022-08-01T14:49:28.797801Z"
},
"tags": []
},
"outputs": [],
"source": [
"X_e = pd.read_csv('data/X_engineered.csv')\n",
"X_s = pd.read_csv('data/X_straight.csv')\n",
"y = pd.read_csv('data/y.csv').mpg"
]
},
{
"cell_type": "markdown",
"id": "046eba55-3375-4e28-8776-1bec54e4f72f",
"metadata": {},
"source": [
"Transform it, QuantileTransformer works best in my testing"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "cd8eb496-d624-49a5-b1c8-0e1bed4abc1e",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:28.860006Z",
"iopub.status.busy": "2022-08-01T14:49:28.859406Z",
"iopub.status.idle": "2022-08-01T14:49:28.876483Z",
"shell.execute_reply": "2022-08-01T14:49:28.875734Z",
"shell.execute_reply.started": "2022-08-01T14:49:28.859962Z"
},
"tags": []
},
"outputs": [],
"source": [
"qt = QuantileTransformer(n_quantiles=297)\n",
"qt_eng = qt.fit_transform(X_e)\n",
"qt_str = qt.fit_transform(X_s)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "9fa8177f-8491-4a10-8515-4678c25a1abe",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:28.878114Z",
"iopub.status.busy": "2022-08-01T14:49:28.877540Z",
"iopub.status.idle": "2022-08-01T14:49:28.888152Z",
"shell.execute_reply": "2022-08-01T14:49:28.887394Z",
"shell.execute_reply.started": "2022-08-01T14:49:28.878087Z"
},
"tags": []
},
"outputs": [],
"source": [
"def run(X,y,model_type):\n",
" r2_test_list = []\n",
" r2_train_list = []\n",
" rmse_test_list = []\n",
" rmse_train_list = []\n",
" \n",
" for i in range(201):\n",
" X_train, X_test, y_train, y_test = train_test_split(X, y)\n",
" \n",
" model = model_type.fit(X_train,y_train)\n",
" test_predict = model.predict(X_test)\n",
" train_predict = model.predict(X_train)\n",
" \n",
" r2_test = r2_score(y_test, test_predict)\n",
" r2_train = r2_score(y_train, train_predict)\n",
" rmse_test = mean_squared_error(y_test, test_predict ,squared=False)\n",
" rmse_train = mean_squared_error(y_train, train_predict ,squared=False)\n",
" \n",
" r2_test_list.append(r2_test)\n",
" r2_train_list.append(r2_train)\n",
" rmse_test_list.append(rmse_test)\n",
" rmse_train_list.append(rmse_train)\n",
"\n",
" plt.subplots(figsize=(10,6))\n",
" plt.title('R-squared over 200 iterations')\n",
" plt.plot(r2_test_list,label='R2 Test')\n",
" plt.plot(r2_train_list,label='R2 Train')\n",
" plt.legend()\n",
" plt.show();\n",
" \n",
" avg = np.mean\n",
" print(f'''\\\n",
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: {min(r2_test_list):.2f} | Min:{min(r2_train_list):.2f} | Min: {min(rmse_test_list):.2f} | Min:{min(rmse_train_list):.2f} |\n",
"| Avg: {avg(r2_test_list):.2f} | Avg:{avg(r2_train_list):.2f} | Avg: {avg(rmse_test_list):.2f} | Avg:{avg(rmse_train_list):.2f} |\n",
"| Max: {max(r2_test_list):.2f} | Max:{max(r2_train_list):.2f} | Max: {max(rmse_test_list):.2f} | Max:{max(rmse_train_list):.2f} |\n",
"'-------------------------------------------------'\n",
" ''')\n",
" \n",
" plt.subplots(figsize=(10,5))\n",
" plt.title('RMSE over 200 iterations')\n",
" plt.plot(rmse_test_list,label='RMSE Test')\n",
" plt.plot(rmse_train_list,label='RMSE Train')\n",
" plt.legend()\n",
" plt.show();"
]
},
{
"cell_type": "markdown",
"id": "a91815c9-27db-495e-bc3d-1d8d160129de",
"metadata": {},
"source": [
"# Linear Regression"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "9a4029e4-1e8c-442f-ac56-66a8f6aaa62d",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:28.889515Z",
"iopub.status.busy": "2022-08-01T14:49:28.889180Z",
"iopub.status.idle": "2022-08-01T14:49:29.884061Z",
"shell.execute_reply": "2022-08-01T14:49:29.883304Z",
"shell.execute_reply.started": "2022-08-01T14:49:28.889488Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Linear Regression With Engineered Features\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAF1CAYAAADbfv+XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9d5xtWVnm/117n3xO5aqbu+/tTAe6b9NA06DQIDkomAGFUUYGB0XH0Rkcx/BTUBkxoSiCImKgiZJz6Aaa0IG+nePNoW7lqlMn77B+f6y1djihwr11btzP51Ofqjph77XTWs963ud9l5BSkiBBggQJEiRIkGBjYZ3uBiRIkCBBggQJEpyLSEhWggQJEiRIkCBBH5CQrAQJEiRIkCBBgj4gIVkJEiRIkCBBggR9QEKyEiRIkCBBggQJ+oCEZCVIkCBBggQJEvQBCclKkCDBKYMQ4mYhxJHT3Y7TCSHEe4QQv3ua2/CgEOLm09mGBAnOByQkK0GCMwRCiANCiLoQoiKEOC6E+IAQonS623U+QAjxMiHEt4UQi/rcv08IMRB5PyuEeL8Qoqzf/4227+8WQtwthKjp37t77UtK+SYp5R/p7/WddOr76G1tbbhaSnlrP/ebIEGChGQlSHCm4RVSyhKwG7ge+O3T25yVIYSwT3cb1gshRKrLy0PA24BtwJXADuDPIu//AXAZsBN4LvC/hBAv1tvLAJ8C/g0YAf4F+JR+va/ocSwJEiQ4Q5CQrAQJzkBIKY8DX0KRra4QQvwXIcQ+IcSyEGK/EOK1+nVbCPFOIcSsfv/NQghpBmStmD0/sp0/EEL8W+T/j2q1ZkkI8U0hxNWR9z4ghPh7IcTnhRBV4LlCiG1CiI8LIWZ0O94S+Xxef2dBCPEQ8LSVjlsI8UwhxJ1633cKIZ6pX/9ZIcRdbZ/9H0KIT+u/s/qYDwkhpnRILq/fu1kIcUQI8b+FEMeBf+5yvv9DSvlFKWVNSrkAvA94VuQjrwP+SEq5IKV8WL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cgX38fFxuWvXrtPdjAQJEiRIkCBBglVx9913z0opJ9pfPyNJ1q5du7jrrrtOdzMSJEiQIEGCBAlWhRCi65JhSbgwQYIECRIkSJCgD0hIVoIECRIkSJAgQR+QkKwECRIkSJAgQYI+4Iz0ZHWD4zgcOXKERqNxuptyxiOXy7Fjxw7S6fTpbkqCBAkSJEhw3uKsIVlHjhxhYGCAXbt2IYQ43c05YyGlZG5ujiNHjnDRRRed7uYkSJAgQYIE5y3OmnBho9FgbGwsIVirQAjB2NhYovglSJAgQYIEpxlnDckCEoK1RiTnKUGCBAkSJDj9OKtI1umGbdvs3r2ba665hle84hUsLi4CsGfPHm666Sauvvpqrr32Wj784Q93fPfNb34zu3fv5qqrriKfz7N79252797Nxz72sTXte3Fxkb/7u7/byMNJkCBBggQJEvQRZ+QC0U996lNlezHShx9+mCuvvPI0tUihVCpRqVQAeP3rX8/ll1/O7/zO7/DYY48hhOCyyy7j2LFj3HDDDTz88MMMDw93bOPAgQO8/OUv54EHHljXvtf7vTPhfCVIkCBBggTnA4QQd0spn9r+eqJknSBuuukmjh49CsDll1/OZZddBsC2bdvYtGkTMzMzq26jWq3yi7/4izztaU/j+uuv51Of+hQADz74IE9/+tPZvXs31157LY8//jhvfetb2bt3L7t37+a3fuu3+ndgCRIkSJAgQYINwVmTXRjF//eZB3noWHlDt3nVtkF+/xVXr+mznufxta99jTe84Q0d791xxx20Wi0uueSSVbfz9re/nec973m8//3vZ3Fxkac//ek8//nP5z3veQ+/9mu/xmtf+1parRae5/Gnf/qnPPDAA+zZs2e9h5YgQYIECRIkOA04K0nW6UK9Xmf37t0cOHCAG264gRe
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.62 | Min:0.71 | Min: 3.16 | Min:3.65 |\n",
"| Avg: 0.73 | Avg:0.74 | Avg: 4.04 | Avg:3.96 |\n",
"| Max: 0.82 | Max:0.77 | Max: 4.88 | Max:4.23 |\n",
"'-------------------------------------------------'\n",
" \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAE/CAYAAAB1vdadAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9d5gkV3ku/p4KnXvizs7mqLQK7CqgQBDJIGGQRA4mCmxdku2L+YHti7Ex4dqAsblcdAkGI5KREElGCEkkCYSsrFXarM07O3l6pmPF8/vjnFN1qro6Tdid0db7PPPMTHd1V3V11Tnveb/3+z5CKUWMGDFixIgRI0aM+YVysg8gRowYMWLEiBHjmYiYZMWIESNGjBgxYiwAYpIVI0aMGDFixIixAIhJVowYMWLEiBEjxgIgJlkxYsSIESNGjBgLgJhkxYgRI0aMGDFiLABikhUjRowYswAhZB0hpEQIUU/iMbyFEHLnydp/jBgxmiMmWTFiLHEQQg4SQqp8wh8mhNxACMlJz99ACKGEkKtDr/sCf/yd/P8EIeTzhJCj/L0OEEL+rcF+xM+XTtgHbQOEkCQh5BuEkEOEkCIh5FFCyMtD27yEELKLEFIhhPyWELJeeo4QQj5DCJngP58lhJCofVFKD1NKc5RSh7/2LkLIny7gZ9vAvy9NOobvUUpftlD7jBEjxtwQk6wYMZ4ZuIpSmgOwDcD5AP429PweAO8Q//CJ+vUAnpa2+VsAFwG4GEAewIsAPBq1H+nnA/P6KToAJ0ThMUwDcATACwB0A/gYgB8QQjbw1ywD8GP+eB+AhwDcJL3+OgCvArAVwLMAvBLA/1iwDyHhZCpiMWLEWBjEJCtGjGcQKKXDAO4AI1syfgbguYSQXv7/lQAeBzAsbfNsAD+hlA5RhoOU0m/P5ji4ovQFQsgQ//kCISTJn9t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sGDFixIgRI0aMBUBMsmLEiBEjRowYMRYAi9KTFQXLsnD06FHUarWTfSjPaKRSKaxZswa6rp/sQ4kRI0aMGDGWNJYMyTp69Cjy+Tw2bNgAQsjJPpxnJCilmJiYwNGjR7Fx48aTfTgxYsSIESPGksaSCRfWajX09/fHBGsBQQhBf39/rBbGiBEjRowY84AlQ7IAxATrBCA+xzFixIgRI8b8YEmRrJMNVVWxbds2nHvuubjqqqtQKBQAAAcPHgQhBB/72Me8bcfHx6HrOj7wgQ8AAHbv3o0XvvCF2LZtG7Zs2YLrrrsOAHDXXXehu7sb27Zt835+9atfBfZ7ySWXYNu2bVi3bh0GBga87Q4ePNjWcW/fvh233Xbb3E9AjBgxYsSIEaNtLBlP1mJAOp3G9u3bAQDveMc7cP311+OjH/0oAGDTpk249dZb8clPfhIAcPPNN+Occ87xXvsXf/EX+OAHP4hrrrkGAPDEE094zz3/+c/Hrbfe2nC/999/PwDghhtuwEMPPYQvfelLHR339u3b8dBDD+GP//iPO3pdjBgxYsSIEWP2iJWsWeKyyy7DsWPHvP/T6TS2bNniVaq/6aab8IY3vMF7/vjx41izZo33/3nnnTen/T/99NO48sorceGFF+L5z38+du3aBYCRu3PPPRdbt27F5ZdfDtM08fd///e46aabsG3bNtx0001z2m+nmK5Y2H6kcEL3GSNGjBgxYiwGxErWLOA4Dn7961/j3e9+d+DxN73pTbjxxhuxYsUKqKqKVatWYWhoCADwwQ9+EC9+8YvxnOc8By972ctw7bXXoqenBwDw+9//Htu2bfPe50c/+hE2b97c9Biuu+46fOUrX8Hpp5+O+++/H+973/vwm9/8Bp/4xCdwxx13YPXq1SgUCkgkEvjEJz4xKwVsPvDd+w/hi7/ei12fvDL2e8WIESNGjFMKS5Jk/ePPnsKOoZl5fc+zV3X
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"print('Linear Regression With Engineered Features')\n",
"run(qt_eng,y,LinearRegression())"
]
},
{
"cell_type": "markdown",
"id": "ec59f39b-e805-42f8-b8c8-2bad572b3e94",
"metadata": {},
"source": [
"This is my most robust model when fed unseen data despite the slightly lower relative scores"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "af02cb2a-a36b-4d57-9a8a-dea4923fd804",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:29.885712Z",
"iopub.status.busy": "2022-08-01T14:49:29.885123Z",
"iopub.status.idle": "2022-08-01T14:49:30.819624Z",
"shell.execute_reply": "2022-08-01T14:49:30.818807Z",
"shell.execute_reply.started": "2022-08-01T14:49:29.885686Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Linear Regression With Vanilla Features\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAF1CAYAAADbfv+XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9d5wkV3nu/z1Vnbsnz2zWBq1WK2lX0iogJLCNwAQjwIAxNibacI3xhYuvr7GNsXG4Bl/bYGxjy/ADEwyYnHNGRAnFlbTKm+PsxJ7OoarO749zTlV1T3fPzO6MVqut5/PZT892qK6ucM5znvd531dIKYkQIUKECBEiRIiwvLDO9A5EiBAhQoQIESI8HhGRrAgRIkSIECFChBVARLIiRIgQIUKECBFWABHJihAhQoQIESJEWAFEJCtChAgRIkSIEGEFEJGsCBEiRIgQIUKEFUBEsiJEiPCoQQhxvRDi6JnejzMJIcR7hRBvPcP7cJ8Q4vozuQ8RIpwLiEhWhAiPEQghDgohqkKIkhBiXAjxYSFE7kzv17kAIcRzhBA/EULk9bF/vxCiL/R6UgjxQSFEQb/+f9o+v0sIcYcQoqIfd3X7Linl66SUf6s/t+KkU19Hb2vbhx1SyptW8nsjRIgQkawIER5reJ6UMgfsAq4A/uzM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bb6XRaLB169YFt/P2t7+dpz3taXzwgx8kn89zzTXX8PSnP533vve9/MEf/AEve9nLaDQauK7L3//937Nnzx5279691J8WIUKECBEiRDgDiJSsJaBarbJr1y5GRkaYmZn
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.58 | Min:0.73 | Min: 3.10 | Min:3.51 |\n",
"| Avg: 0.74 | Avg:0.76 | Avg: 3.93 | Avg:3.86 |\n",
"| Max: 0.83 | Max:0.80 | Max: 4.81 | Max:4.11 |\n",
"'-------------------------------------------------'\n",
" \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAE/CAYAAAB1vdadAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9eZgcV3k1fm4tvXfPPtplSZZsy6uMDTZ2vAM2YXECYQsJZkn8EcIXwo+EhBAIH4R8+UIIhOAECCQmQLDDajDGNjYY74tsS5Zl7fs2+/RM713L/f1x7626VV29TfdII6nO8/ixpru6qrq66t5zz3ve9yWUUoQIESJEiBAhQoToLpQTfQIhQoQIESJEiBCnIkKSFSJEiBAhQoQIMQ8ISVaIECFChAgRIsQ8ICRZIUKECBEiRIgQ84CQZIUIESJEiBAhQswDQpIVIkSIECFChAgxDwhJVogQIULMAYSQlYSQPCFEPYHn8E5CyP0n6vghQoRojJBkhQhxkoMQsp8QUuIT/ggh5HZCSEp6/3ZCCCWEvNH3uS/y19/N/44QQj5PCDnM97WPEPKFOscR/335uH3RFkAIiRJCvkEIOUAIyRFCnieEvNa3zQ2EkO2EkCIh5FeEk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wYqqpi6dKlznsf/vCHcf311+O1r30tvvCFLzihRgB45JFHPOHCPXv2ND2HW2+9Ff/yL/+CZ599Fv/4j/+ID3zgAwCAT3/607jvvvuwefNm/OQnP0EkEsGnP/1pvO1tb8OmTZvwtre9rTsXQUIYLgxxSqJkWLApUKiESlaIECFOH/yfn27FS0d
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"print('Linear Regression With Vanilla Features')\n",
"run(qt_str,y,LinearRegression())"
]
},
{
"cell_type": "markdown",
"id": "6221948e-2f64-4064-9745-04b3a7315b43",
"metadata": {},
"source": [
"The score is about the same as with vanilla features"
]
},
{
"cell_type": "markdown",
"id": "fb179282-11cc-42c8-bf0c-ec5165aa698d",
"metadata": {},
"source": [
"# Ridge"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "7b0153c9-559e-4bb2-bfbb-88c856904560",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:30.822950Z",
"iopub.status.busy": "2022-08-01T14:49:30.822472Z",
"iopub.status.idle": "2022-08-01T14:49:31.679151Z",
"shell.execute_reply": "2022-08-01T14:49:31.678407Z",
"shell.execute_reply.started": "2022-08-01T14:49:30.822921Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ridge With Engineered Features\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAF1CAYAAADbfv+XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOx9Z5hkV3XtOjdUDp27JwdplHMAJJJEFibZxjbB2MYYzMMYB/xsbOyHA/AcsAnPNsbYBBOMsckgQAFJBAUUR9KMNDl3DtWV66bzfuxzbqi6VV3VM9M9PXPX981X0xVu3brhnHXWX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BF7y4R+ialirvSsrhohkRYgQIUKECGsIs2UD33hsHPfun13tXekJs5UGGpaDmmGv9q6sGCKSFSFChAgRIqwhmLYDAGhYzirvSW8wxP7aDl/lPVk5RCQrQoQIESJEWEOwBElZqyTLjEhWhAgRIkSIEOFMhO0QWambayvsJkmWZa8tcngyiEhWhAgRIkSIsIZg2mtUyRLkyoqUrAgRIkSIECHCmQjpaVq7SlZEsiKsIM6lTIsIESJEiHByWOvGd8tZW/t9MohI1ipj57ECLv/z7+NEobbauxIhQoQIEdYArDWqZDXsSMmKsMI4UajBcjgmF+urvSsRIkSIEGENwFqrnqxIyYqw0nBTWs+hbIsIEdYavv34OA7PnlvtQCKcuZAkZc2SrEjJirBSkBedscZulggRziX8wX/vxBd/enS1dyNCBABrN1zoKVkRyYqwQpAx6kjJihDhzATnHA3LWXMTWoSzF2s2XHgOzncRyVplREpWhAhnNmyHg/PoHl0KDcv
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.56 | Min:0.71 | Min: 3.14 | Min:3.65 |\n",
"| Avg: 0.73 | Avg:0.74 | Avg: 4.03 | Avg:3.99 |\n",
"| Max: 0.82 | Max:0.78 | Max: 4.92 | Max:4.25 |\n",
"'-------------------------------------------------'\n",
" \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAE/CAYAAAB1vdadAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9eZgcV3k1fm5VdfU63bNqtIxWr7JsLGxjY4wxSzBmdcJqAmEJxGEL+RySfCR8LCE7+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H6wzu7v5c8ZhJCPgHV3lwF8g1LaarPVECFChAgRIkSIUxZLsq3OZZddRkNPVogQIUKECNEcuq5jeHgYlUplsQ/ltEcsFsPQ0BAikYjncULIVkrpZf7t26mTFSJEiBAhQoRYYhgeHkZXVxfWrVsHHnUKcRJAKcXU1BSGh4exfv36lvYJ2+qECBEiRIgQpzAqlQr6+vpCgnWSQQhBX19fW4phSLJChAgRIkSIUxwhwVoYtHueQ5IVIkSIECFChOgIsixj8+bNuPDCC/H6178e2WwWAHD48GEQQvDJT37S3nZychKRSAQf+chHAAB79+7FS1/6UmzevBkbN27EjTfeCAB44IEHkMlksHnzZvvnvvvu87zvFVdcgc2bN2PNmjUYGBiwtzt8+HBLx/3MM8/g7rvv7vwE1EHoyQoRIkSIECFCdIR4PI5nnnkGAPDud78bN998Mz7xiU8AADZs2IC77roLf//3fw8A+OEPf4hNmzbZ+370ox/FTTfdhOuvZ133duzYYT939dVX46677qr7vo8//jgA4JZbbsGWLVvw5S9/ua3jfuaZZ7Blyxa85jWvaWu
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"print('Ridge With Engineered Features')\n",
"run(qt_eng,y,Ridge())"
]
},
{
"cell_type": "markdown",
"id": "9247f6ce-9225-4379-922a-7d775eb794ef",
"metadata": {},
"source": [
"Ridge performs slightly worse than linear regression"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "029bb1c5-322f-45e2-840e-26325183e175",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:31.680788Z",
"iopub.status.busy": "2022-08-01T14:49:31.680205Z",
"iopub.status.idle": "2022-08-01T14:49:32.521703Z",
"shell.execute_reply": "2022-08-01T14:49:32.520950Z",
"shell.execute_reply.started": "2022-08-01T14:49:31.680761Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ridge With Vanilla Features\n"
]
},
{
"data": {
"image/png": "iVBORw0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DBBggQJEiRIkGAdkJCsBAkSJEiQIEGCdUBCshIkSJAgQYIECdYBp6UnK0GCBAkSJEiw/nBdl+npaRqNxqnelTMCuVyObdu2kU6nB3p/QrISJEiQIEGCxymmp6cZGhrinHPOQQhxqnfntIaUktnZWaanp9mxY8dAn0nChQkSJEiQIMHjFI1Gg4mJiYRgDQAhBBMTEytS/RKSlSBBggQJEjyOkRCswbHSc5WQrAQJEiRIkCDBKYNt2+zcuZPLL7+cl7/85ZTLZQDuvPNOrrnmGi677DKuvPJKPv3pT3d89q1vfSs7d+7k0ksvJZ/Ps3PnTnbu3MlnP/vZgb67XC7zD//wD2t5OC04LRtEP/nJT5ZJMdIECRIkSJBgffHAAw9wySWXnNJ9KJVKVCoVAN70pjdx4YUX8kd/9Ec8/PDDCCG44IILOHToEE960pN44IEHGB0d7djG3r17ednLXsa99967ou9ezee6nTMhxO1Syie3vzdRshIkSJAgQYIEpwWuueYaDh48CMCFF17IBRdcAMCWLVvYsGEDx48fX3Yb1WqVX/3VX+UpT3kKT3jCE/jiF78IwH333cfVV1/Nzp07ufLKK3nkkUd4+9vfzq5du9i5cye///u/v+bHk2QXJkiQIEGCBAn40y/fx/2HFtd0m5duGeadL79soPf6vs93vvMdfu3Xfq3jtVtuuQXHcTjvvPOW3c5f/MVf8NznPpcPf/jDlMtlrr76ap7//Ofz/ve/n9/+7d/mDW94A47j4Ps+f/VXf8W9997LnXfeudJDGwiJkpXgpMPxAvbOVE/1biRIkCBBgtMA9Xq
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.61 | Min:0.72 | Min: 2.94 | Min:3.49 |\n",
"| Avg: 0.74 | Avg:0.75 | Avg: 3.92 | Avg:3.87 |\n",
"| Max: 0.83 | Max:0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8epLe3l9NOOw0hxPHenJMWUkqmpqY4ePAgp59++oLeE4cLY8SIESNGjBMYtVqN4eHhmGCtMIQQDA8PL0oxjElWjBgxYsSIcYIjJljHBos9zjHJihEjRowYMWIcFUzTZPv27Vx44YW88pWvpFAoALB3716EEHzoQx/yXzs5OUkymeQ973kPAI8//jhXXnkl27dv57zzzuPqq68G4NZbb6W/v5/t27f7PzfffHPT91522WVs376drVu3snbtWv91e/fuXdB279ixgx/84AdHfwA6IPZkxYgRI0aMGDGOCtlslh07dgDw1re+lWuuuYYPfvCDAJxxxhnccMMNfOQjHwHgW9/6FhdccIH/3ve+9728733v49WvfjUADz30kP/cFVdcwQ033NDxe++66y4Arr32Wu655x4+/elPL2q7d+zYwT333MNv/uZvLup9C0WsZMWIESNGjFWNyVKdhw/NHu/NiLFAPOc5z+HQoUP+/9lslvPOO8/v5PKNb3yDN7zhDf7zR44cYfPmzf7/F1100VF9/+7du7nqqqu45JJLuOKKK3jssccARe4uvPBCLr74Yp73vOfRaDT4i7/4C77xjW+wfft2vvGNbxzV90YhVrJixIgRI8aqxmdu3c33HjjMrz74G8d7U2LMA8dxuOWWW3jHO97R9Pib3vQmrrvuOtavX49pmmzcuJHDhw8D8L73vY8XvvCFXH755bzkJS/h7W9/OwMDAwDcdtttbN++3f+c73znO5x55pldt+Hqq6/mM5/5DGeffTZ33XUX7373u/nJT37CX//1X3PTTTexadMmCoUCqVSKv/7rv16SArZQxCQrRowYMWKsahSqFpWGc7w344TAX33/ER49XFzWzzx/Yx9/+coLur6mWq36XqhLLrmEF7/4xU3
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"print('Ridge With Vanilla Features')\n",
"run(qt_str,y,Ridge())"
]
},
{
"cell_type": "markdown",
"id": "bb3e1e40-9979-46fa-9f05-43758bd81da2",
"metadata": {},
"source": [
"There is a slight improvement when using vanilla features"
]
},
{
"cell_type": "markdown",
"id": "b03ef52c-9f3b-4f04-8adb-eda544712a9f",
"metadata": {},
"source": [
"# Lasso"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "29f3bde6-1b2e-425b-833a-d512e0b95948",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:32.523398Z",
"iopub.status.busy": "2022-08-01T14:49:32.522759Z",
"iopub.status.idle": "2022-08-01T14:49:33.371746Z",
"shell.execute_reply": "2022-08-01T14:49:33.371016Z",
"shell.execute_reply.started": "2022-08-01T14:49:32.523371Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Lasso With Engineered Features\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAF1CAYAAADbfv+XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAD+t0lEQVR4nOy9d7xlV3ne/117n95uv1M0oxlp1CXEAAIkCDbYNFOMGzYu4NjEDokd4pbEieM4ccB2HH42xpaDAWMZFwwGm97B9CIkGAn1kUbTy+339F3X74+11t77tFtGM5o7aD+fjz5Xc+o+e6+91rOe93nfV0gpSZEiRYoUKVKkSHFuYV3oA0iRIkWKFClSpPhuREqyUqRIkSJFihQpzgNSkpUiRYoUKVKkSHEekJKsFClSpEiRIkWK84CUZKVIkSJFihQpUpwHpCQrRYoUKVKkSJHiPCAlWSlSpHjcIIR4rhDi+IU+jgsJIcRbhRC/fYGP4V4hxHMv5DGkSPFEQEqyUqTYIhBCHBZCdIQQTSHEaSHEbUKIyoU+ricChBAvFUJ8WQixos/924UQ1cTzeSHEO4UQdf38r/W9f78Q4k4hRFv/3T/qu6SUr5NS/m/9vvNOOvU4ekPfMVwvpfz8+fzeFClSpCQrRYqthpdLKSvAfuApwH+9sIezNoQQ9oU+hs1CCJEZ8vAY8AZgJ3AtsAv4v4nn/ydwJbAH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5VciAmZw6623cuDAAT72sY+xb98+Dhw4wIEDB/ixH/uxDX13SrJSpEiRIkWKiwsbIVnfBK4UQlwmhMgBrwI+1PeaDwLPEUJkhBAl4JnA/Rt870WJW265hRMnTgB
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.34 | Min:0.45 | Min: 4.26 | Min:5.11 |\n",
"| Avg: 0.51 | Avg:0.51 | Avg: 5.49 | Avg:5.43 |\n",
"| Max: 0.60 | Max:0.57 | Max: 6.58 | Max:5.64 |\n",
"'-------------------------------------------------'\n",
" \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlMAAAE/CAYAAABin0ZUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAADyt0lEQVR4nOx9d5gkV3X9eRU6Tg47m3e1UdIq54AiEkLkbBAmY4LBP9tgwBgbY2NsjAM5mZyTACGEhCRQQFnalTZqc96dmd2JPZ0rvd8fr96rV9XVPd3Tvbuz2jrft9/sdNdUV1VXvXffueeeSyiliBAhQoQIESJEiDAzKCf6ACJEiBAhQoQIEU5mRMFUhAgRIkSIECFCE4iCqQgRIkSIECFChCYQBVMRIkSIECFChAhNIAqmIkSIECFChAgRmkAUTEWIECFChAgRIjSBKJiKECFChCoghCwmhOQIIeoJPIY3EkLuOVGfHyFChOkRBVMRIpwEIITsI4QU3Yl9mBDyXUJIm/T+dwkhlBDyssDffc59/a3u7zFCyP8QQg65+9pLCPlslc/h/7503E60DhBC4oSQbxFC9hNCsoSQZwghNwe2eT4hZBshpEAIuZ8QskR6jxBC/pMQMub++w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SAhZ7b70fADPytsQQuYSQoj7/0vc/UZLoecgplxrBDNK8wnYDhXC/AgRZhN4MGVEwVSECMcU9fpM/RWAHxFCNgI4D8C/E0LeQwh5j/v+awBsJoRsAPAFAK+nlEaz7XMQnJmyozSfwC/XHcLVn7k/coWPMOtguPekEd2bESIcU9RljUApXQ/gosDLX5Pe/xKAL7X
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"print('Lasso With Engineered Features')\n",
"run(qt_eng,y,Lasso())"
]
},
{
"cell_type": "markdown",
"id": "02e7253e-e056-4731-ada6-968842ac487a",
"metadata": {},
"source": [
"Lasso peforms even worse"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "81916ad8-5658-4f66-b92a-054a951ae24f",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:33.373433Z",
"iopub.status.busy": "2022-08-01T14:49:33.372800Z",
"iopub.status.idle": "2022-08-01T14:49:34.299100Z",
"shell.execute_reply": "2022-08-01T14:49:34.298327Z",
"shell.execute_reply.started": "2022-08-01T14:49:33.373405Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Lasso With Vanilla Features\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAF1CAYAAADbfv+XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9d5hc2Vkm/p4bK1dntdTK0iRPcpjkADY4Y2wwmF1jw7ILi/Euu/yIu8CyuwSTWWwMBgO2scGAs42NxwGHGdtje2Y048maoCx1TpWrbjy/P064596qrq6WukctzX2fR0+3qqtu3XjOe97v/b6PUEqRIkWKFClSpEiRYnOhXewdSJEiRYoUKVKkuByRkqwUKVKkSJEiRYotQEqyUq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TJGSrBTPSLgBBQB0/PAi70mKFClSpLhckZKsFM9I+AEjV203DRemSJEiRYqtQUqyUjwj4YdcyUo9WSlSpEiRYouQkqwUz0h4XMlKSVaKFClSpNgqpCRrQJxdaSHk6keKSx8RyUo9WSlSpEiRYmuQkqwBsNRw8D1/cge+dHT+Yu9Kik2Cz43v7VTJSpEiRYoUW4SBSBYh5FWEkCcIIccIIb+6xnteQgh5gBDyKCHkzo18druj0nLhhxSLDedi70qKTYIXpJ6sFClSpEixtTDWewMhRAfwLgAvB3AOwL2EkE9TSh9T3jME4C8BvIpSeoYQMjHoZy8FuL6YkNPQ0uUCP+TZhSnJSpEiRYoUW4RBlKxbAByjlJ6glLoAPgTgBxLveROAT1BKzwAApXRhA5/d9nC5f8fx0wn5coHwZDkpyUqRIkWKFFuEQUjWFICzyv/P8ddUXAl
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.37 | Min:0.50 | Min: 4.39 | Min:4.96 |\n",
"| Avg: 0.54 | Avg:0.55 | Avg: 5.29 | Avg:5.26 |\n",
"| Max: 0.61 | Max:0.59 | Max: 6.64 | Max:5.48 |\n",
"'-------------------------------------------------'\n",
" \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlMAAAE/CAYAAABin0ZUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAADyeUlEQVR4nOy9d5wdV3n//z4zt26v6l2WZFu2JXeaG82mE3oJxcDPgQT4hpCQ5BsgCSUhAZLAFwiEZkKzMc1gjAvFvRe5qkurrtX2dveWmTm/P86cKbfs7r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g2muv5ZFHHuErX/lKVce9ZcsWHnnkEV7+8pdX9XdTRaRMRYgQIUKEUxqDmTxbDgwe78OYd3juc5/LoUOHvN/T6TRnnHGG193k+uuv501vepP3/pEjR1i2bJn3+9lnnz2tz9+9ezdXXXUV559/Ppdccgnbtm0DFIk766yz2LRpE5deein5fJ5PfvKTXH/99WzevJnrr79+Wp9bDpEyFSFChAgRTml87759/Pedu9j6qasiT9IUYds2v//973nve98bev0tb3kL1113HYsWLcI0TZYsWcLhw4cB+MhHPsILX/hCnve85/HSl76Uq6++mpaWFgDuvvtuNm/e7O3nZz/7GWvXrp3wGK655hq+/vWvs27dOh588EH+/M//nD/84Q986lOf4tZbb2Xp0qUMDg6SSCT41Kc+VZOiNVVEZCpChAgRIpzSGMjkyRYc8rZDMmYe78OZEv7518/w7OHhGd3nmUua+MdXbZxwm/Hxcc+rdP755/OSl7wk9P5VV13FJz7xCRYuXMib3/zm0HtXX301V155Jbf
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"print('Lasso With Vanilla Features')\n",
"run(qt_str,y,Lasso())"
]
},
{
"cell_type": "markdown",
"id": "17dfe090-712a-44b3-861d-3e3e869842f0",
"metadata": {},
"source": [
"Again, slightly better numbers with vanilla features"
]
},
{
"cell_type": "markdown",
"id": "0e026f52-4958-48e1-a214-d64d81d309a7",
"metadata": {},
"source": [
"# SVR"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "f9950905-f0bb-4db7-b893-0a27d962fcc1",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:34.300873Z",
"iopub.status.busy": "2022-08-01T14:49:34.300233Z",
"iopub.status.idle": "2022-08-01T14:49:35.125538Z",
"shell.execute_reply": "2022-08-01T14:49:35.124793Z",
"shell.execute_reply.started": "2022-08-01T14:49:34.300844Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"LinearSVR With Engineered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EEXsCY7uA8PD9Pt27ev9mEkSJAgQYIECRK0xH333TdFKR0Jv74mSdb27dtx7733rvZhJEiQIEGCBAkStAQhJLZlWBIuTJAgQYIECRIk6AISkpUgQYIECRIkSNAFJCQrQYIECRIkSJCgC1iTnqw42LaNI0eOoFarrfahrHlkMhls3rwZpmmu9qEkSJAgQYIEJy3aIlmEkJeCNS3VAXyeUvqJ0Pt/CuDtyjbPBjBCKZ0hhBwAUATrzu5QSp+xlAM9cuQIenp6sH37dhBClrKJkwKUUkxPT+PIkSPYsWPHah9OggQJEiRIcNKiZbiQEKIDuArAywCcA+CthJBz1M9QSj9JKd1JKd0J4EMAfkopnVE+8gL+/pIIFgDUajUMDQ0lBKsFCCEYGhpKFL8ECRIkSJBgldGOJ+sSAE9SSvdRSi0AXwfwmiaffyuAr3Xi4MJICFZ7SK5TggQJEiRIsPpoh2RtAnBY+f8R/loEhJAcgJcC+JbyMgVwMyHkPkLIe5Z6oGsBuq5j586dOO+88/CqV70Kc3NzAIBdu3bh8ssvx7nnnosLLrgA3/jGNyJ/+773vQ87d+7EOeecg2w2i507d2Lnzp24/vrr29r33NwcPvOZz3TydBIkSJAgQYIEXUQ7JCtOFmnUVfpVAO4IhQqfTSn9FbBw4/sIIc+L3Qkh7yGE3EsIuXdycrKNw1p5ZLNZ7Nq1C7t378bg4CCuuuoqAEAul8O1116LPXv24Ac/+AH+8A//UBIwgauuugq7du3CTTfdhFNPPRW7du3Crl278MY3vrGtfSckK0GCBAkSJDix0A7JOgJgi/L/zQCONfjsWxAKFVJKj/GfEwC+AxZ+jIBS+llK6TMopc8YGYl
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.53 | Min:0.60 | Min: 3.48 | Min:4.22 |\n",
"| Avg: 0.65 | Avg:0.65 | Avg: 4.59 | Avg:4.60 |\n",
"| Max: 0.75 | Max:0.70 | Max: 5.68 | Max:4.85 |\n",
"'-------------------------------------------------'\n",
" \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlMAAAE/CAYAAABin0ZUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9d5gkWXUlfl6Y9Jnlq72Z7nEwwzAwwzB4RgKtkEDSCmR2kYRWBhmQXa1+EtpF3ku7IOQFkjDCCuEGJOEZA4zvmZ7p6Wlvy5v0Jtz7/fFMvIiMNFWV3VndFef7+quurMjIiMiI984799x7CaUUMWLEiBEjRowYMdYHbdgHECNGjBgxYsSIcSUjJlMxYsSIESNGjBgbQEymYsSIESNGjBgxNoCYTMWIESNGjBgxYmwAMZmKESNGjBgxYsTYAGIyFSNGjBgxYsSIsQHEZCpGjBgxOoAQspcQUiWE6EM8hjcSQj4/rM+PESNGb8RkKkaMKwCEkDOEkAaf2OcIIf9MCMkpf/9nQgglhHxX6H3v4K//KP89QQj5c0LIBb6v04SQ/9fhc8S/v7xsJ9oHCCFJQsh7CCFnCSEVQshjhJDXhLb5VkLIUUJInRDyFULIPuVvhBDyx4SQZf7vTwghJOqzKKXnKKU5SqnL3/tVQshPXMJz28+/L0M5hn+hlH7bpfrMGDFibBwxmYoR48rB6yilOQC3AngegF8P/f0YgDeJX/iE/H0ATirb/DqA2wHcASAP4C4Aj0V9jvLvrQM9izWAE5/wOGUAOA/gFQBGAPwfAB8lhOzn75kE8G/89XEADwP4iPL+NwP4HgDPBXALgNcC+KlLdhIKhqlwxYgR49IhJlMxYlxhoJTOAfhPMFKl4jMAXkIIGeO/fzuAJwDMKdu8AMAnKKUzlOEMpfR96zkOrhC9gxAyw/+9gxCS5H97mhDyWm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I0aMGH2DENKx6Xoc5osRI0aMGDFixNgAYjIVI0aMGDFixIixAcRkKkaMGDFixIgRYwOIyVSMGDFixIgRI8YGEJOpGDFixIgRI0aMDSAmUzFixIgRI0aMGBtATKZixIgRI0aMGDE2gJhMxYgRI0aMGDFibAAxmYoRI0aMGDFixNgAYjIVI0aMGDFiXMFwXA/3n1ga9mFsacRkKkaMLQTXo3jyYmnYhxEjRowB4mvHFvHGdz+A00u1YR/KlkVMpmLE2EL44tPzeO277sNsqTHsQ4kRI8aAULNc9rPlDPlIti5iMhUjxhZCsW4BAKrNeNCNEeNqgedRAEx5jjEcxGQqRowtBMtlg63txoNujBhXCxxOopyYTA0NMZmKEWMLwXI8APEKNkaMqwmxMjV8xGQqRoyrADPFBj79+EzP7QSZcjzvUh9SjBiXHJRSPHJ2ddiHMXT4ylT8XA8LMZmKEeMqwEceOo9f+PBjPVemPpmKV7Axrnw8eHoFr/+br2/5DFWXxsrUsBGTqRgxrgI0bReU9h5MLZdl/TixZyrGVYCFSgsAUGrYQz6S4cJ140XSsBGTqRgxrgK0+vRCxZ6pGFcTyk1GolqOO+QjGS7E2siNF0lDQ0ymYsS4CiAmk16eCUGm7NhbEeMqQLnBSny07K19P7terEwNGzGZihHjKkDfyhQPB8Qr2BhXA4QyJe7rrQpx+rHiPDzEZCpGjKsArT6N5a04my/GVYQy90rFylT8XA8bMZmKEeMqgJhMeq1MRbHOOBwQ42qAMJ5vec9UrEwNHTGZ2mQ4t1zHZ5+YHfZhxLjCICYTu0e4w+LbxYNujKsBZd4WSSiuWxWxZ2r4iMnUJsMHHzyHX/7ooWEfRowrDGvN5ovbycToB3/wuafxkYfODfswOkKG+bY6mYrrTA0dMZnaZGg57pY3U8ZYO/r1TEkDeuytiNEHPvvELO45vjTsw+gIvzTC1r6f4958w0dMpjYZHJeCUr/XUow
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"print('LinearSVR With Engineered Features')\n",
"run(qt_eng,y,LinearSVR())"
]
},
{
"cell_type": "markdown",
"id": "6a2779d9-1a9c-4719-b5d7-24a061edc416",
"metadata": {},
"source": [
"SVR brings us back up a bit"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "a1fc6b93-6fe9-4b70-a574-567890a233b1",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:35.127199Z",
"iopub.status.busy": "2022-08-01T14:49:35.126590Z",
"iopub.status.idle": "2022-08-01T14:49:35.952920Z",
"shell.execute_reply": "2022-08-01T14:49:35.952171Z",
"shell.execute_reply.started": "2022-08-01T14:49:35.127172Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"LinearSVR With Vanilla Features\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAF1CAYAAADbfv+XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOz9d5hlV3Xmj3/2OefmyqGz1MoZqYUESGCDjMkIAz9nY7DHfJ09OI894zQeYw/OGBsPxgZkbBNsMGAhokhCgFBALakVW+ocK1fdfE/Yvz/23ifcUHWru6urJJ33efqprrrn3nvi3u9+17vWElJKUqRIkSJFihQpUpxZWOu9AylSpEiRIkWKFM9EpCQrRYoUKVKkSJFiDZCSrBQpUqRIkSJFijVASrJSpEiRIkWKFCnWACnJSpEiRYoUKVKkWAOkJCtFihQpUqRIkWINkJKsFClSnDUIIW4SQhxZ7/1YTwgh3iOE+L113oeHhRA3rec+pEjxbEBKslKk2CAQQhwQQtSFEBUhxAkhxC1CiIH13q9nA4QQrxVC3CmEWNDn/h+FEIOx13NCiPcLIZb067/W9v5dQoj7hBA1/XNXr++SUv6clPKP9PvWnHTq++jtbftwpZTyq2v5vSlSpEhJVooUGw2vk1IOALuA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mGKFClSpEiRgj+89WEeObZ0Rj/zim1D/MHrruxrW9/3+dKXvsRb3/rWjtfuvvtuWq0WF1544Yqf88d//Me89KUv5f3vfz8LCws8//nP52Uvexnvec97+OVf/mXe9KY30Wq18H2fd7zjHezZs4fdu3ev9tD6QqpkpUiRIkWKFGuAYwt1Kk1vvXd
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.53 | Min:0.64 | Min: 3.43 | Min:3.87 |\n",
"| Avg: 0.68 | Avg:0.69 | Avg: 4.39 | Avg:4.35 |\n",
"| Max: 0.78 | Max:0.73 | Max: 5.91 | Max:4.70 |\n",
"'-------------------------------------------------'\n",
" \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlMAAAE/CAYAAABin0ZUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAD330lEQVR4nOy9d5wkV3nu/z1VnXt68myOypFdJQQICYGMEGDA12TbP6ItGxsHnO61ufjaYBywccBgg22iwRZBgIgCBAgJEAKFXe1K2tVKq42zYXLoWOH8/jh1qqvTTE/ekc7z+cxnZjpUVVdXnfOc533e9xVSSgwMDAwMDAwMDOYHa6UPwMDAwMDAwMBgNcOQKQMDAwMDAwODBcCQKQMDAwMDAwODBcCQKQMDAwMDAwODBcCQKQMDAwMDAwODBcCQKQMDAwMDAwODBcCQKQMDA4MWEEJsEUJMCyHsFTyGXxZCfHul9m9gYDA7DJkyMFgFEEIcEkIUg4n9pBDiE0KIjsjznxBCSCHEy+ve90/B428K/k8IId4vhDgWbOtJIcQ/ttiP/vngsn3QNiC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56LL744fO/v/M7v8I53vINXvOIVAOzZsyd87tprr+VrX/tay/3ee6/KgfvEJz7Bfffdxwc/+ME5HfeuXbu47777eMlLXjKn97ULo0ytUpQcj3ueGFnpwzAwMDAweJri2c9+NsePHw//T6fTXHjhhWF3k89+9rO85jWvCZ8/ceIEmzZtCv+/9NJLF7T/J554gptuuokrrriCa6+9ln379gGKxF1yySXs2LGD6667jkqlwp/92Z/x2c9+lp07d/LZz352QfttBqNMrVJ
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"print('LinearSVR With Vanilla Features')\n",
"run(qt_str,y,LinearSVR())"
]
},
{
"cell_type": "markdown",
"id": "7a8e42de-4c8c-4603-8adc-81e97245781d",
"metadata": {},
"source": [
"And again slightly improved numbers with vanilla features on training data"
]
},
{
"cell_type": "markdown",
"id": "188ef03e-5f31-4b85-9249-32f8184f8999",
"metadata": {},
"source": [
"# KNN"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "a6244b33-23a6-410f-bca2-139c7cecbbf9",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:35.954613Z",
"iopub.status.busy": "2022-08-01T14:49:35.953980Z",
"iopub.status.idle": "2022-08-01T14:49:37.141682Z",
"shell.execute_reply": "2022-08-01T14:49:37.140855Z",
"shell.execute_reply.started": "2022-08-01T14:49:35.954585Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"KNeighborsRegressor With Engineered Features\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAF1CAYAAADbfv+XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOx9eZgcV3X9eb13zz6jGe2yZFuWLcmyvGKzGrAxYJsl7Ht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Eenp6IsYvQoQIESJEmGecMEEWgCjACojoPEWIECFChAjzjxMqyJpvxONxbN68GRs3bsTVV1+N0dFRAMCWLVtwySWXYMOGDdi0aROuu+66uue+853vxObNm7F+/Xpks1ls3rwZmzdvxo9+9KNA7z06Oor/+Z//mcmPEyFChAgRIkSYRSzIBtEXXHCBdJuRbt++HWedddY8HRGhtbUVk5OTAIA3velNOOOMM/DhD38Yjz/+OIQQWLt2LQ4fPozzzz8f27dvR2dnZ91r7Nu3D1dddRW2bdsW6r3DPm8hnK8IESJEiBDhZIAQ4kEp5QXu2yMmq0lccsklOHToEADgjDPOwNq1awEAy5YtQ19fHwYHBxu+xtTUFN7ylrfgwgsvxLnnnouf//znAIBHH30UF110ETZv3oxNmzbhiSeewAc+8AHs3r0bmzdvxvvf//7Z+2ARIkSIECFChBnBCVNdqOKfb3wUjx0en9HXXL+sHR+9ekOgxxqGgVtvvRVvfetb6+677777UC6XcdpppzV8nU984hN4znOeg2984xsYHR3FRRddhMsuuwxf/vKX8Z73vAeve93rUC6
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.56 | Min:0.79 | Min: 3.15 | Min:2.78 |\n",
"| Avg: 0.73 | Avg:0.82 | Avg: 4.03 | Avg:3.27 |\n",
"| Max: 0.82 | Max:0.87 | Max: 4.99 | Max:3.53 |\n",
"'-------------------------------------------------'\n",
" \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlMAAAE/CAYAAABin0ZUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAD5zUlEQVR4nOy9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bZIFU/9HJOU7DTD2Tc76Hc35FyGMvAHC28+96AP+c+kgyZMiQIUOGDEMNVVWxZ88eXHTRRXjJS16ChYUFAMD+/fvBGMO73vUu97kzMzPQdR1vfetbAQAPPvggrrnmGuzZswfnn38+rr/+egDA9773PYyPj2PPnj3uv29/+9u+z73yyiuxZ88e7Ny5Exs2bHCft3///kTHvW/fPnzta1/r/gREoFeaqesAfIJzzgH8jDE2wRjbwjk/2qP3z5AhQ4YMGTKsMorFIvbt2wcAeMMb3oAPf/jDeOc73wkAOOOMM/CVr3wF733vewEAn/vc53DhhRe6r33b296Gt7/97bjuuusAAHfffbf72NOe9jR85StfifzcW265BQDw8Y9/HHv37sWHPvShVMe9b98+7N27Fy984QtTvS4pkjJTHMA3GWO3McauD3l8G4CD0u+HnL/5wBi7njG2lzG2d3p6Ov3RZgjFg8eWcXSxttqHkSFDhgwZTiFcffXVOHz4sPt7sVjE+eef73Y3+exnP4tXvepV7uNHjx7F9u3b3d8vvvjirj7/0UcfxfOf/3xcfvnleNrTnoYHHngAgAjiLrroIuzevRtPf/rTYRgG3v3ud+Ozn/0s9uzZg89+9rNdfW4YkjJTT+WcH2GMbQTwLcbYA5zzH0iPhyUYecsfOP8YgI8BwBVXXNHyeIbO8LufuR27t0/gfa/
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"print('KNeighborsRegressor With Engineered Features')\n",
"run(qt_eng,y,KNeighborsRegressor())"
]
},
{
"cell_type": "markdown",
"id": "4228c418-ff65-4529-8069-7e06c9ac251f",
"metadata": {},
"source": [
"This one seems to be overfitting a bit on the training data, test data performance is about the same as the rest"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "41d2acc7-4d4f-41ec-8909-8518fed7140a",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:37.143413Z",
"iopub.status.busy": "2022-08-01T14:49:37.142828Z",
"iopub.status.idle": "2022-08-01T14:49:38.314930Z",
"shell.execute_reply": "2022-08-01T14:49:38.314159Z",
"shell.execute_reply.started": "2022-08-01T14:49:37.143384Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"KNeighborsRegressor With Vanilla Features\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAF1CAYAAADbfv+XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9d7gkV3Utvk7nvjlOTtIoIyEJhMg5YxNs80wy/hlsY/xwwhgb8HuOOD4b2xgwNmAwtjE55yyiMspxNCNNvjM3h45VdX5/7NpVp06fqq5Ot3s0tb5vvju3b4fqqjrn7LP22msLKSUSJEiQIEGCBAkSdBepfh9AggQJEiRIkCDBwxFJkJUgQYIECRIkSNADJEFWggQJEiRIkCBBD5AEWQkSJEiQIEGCBD1AEmQlSJAgQYIECRL0AEmQlSBBggQJEiRI0AMkQVaCBAk2DUKIpwkhjvb7OPoJIcR7hRD/t8/HcKcQ4mn9PIYECc4GJEFWggQDAiHEg0KIshBiXQhxUgjxISHESL+P62yAEOKnhBA/EEIsu+f+fUKIUeXveSHEvwshVt2//672+iuEEDcJIUruzyvCPktK+Xop5Z+7r+t50OneR2/XjuERUsrv9vJzEyRIkARZCRIMGl4opRwBcAWAKwG8tb+HEw0hRLrfx9AqhBAZw8PjAN4OYAeAiwHsAvD/lL//CYDzAewF8HQAvy+EeJ77fjkAnwPwXwAmAfwHgM+5j/cUId8lQYIEA4IkyEqQYAAhpTwJ4GugYMsIIcQvCSEOCiHWhBCHhBCvch9PCyH+Tggx7/79DUIIyQuyy5g9S3mfPxFC/Jfy+ydctmZFCPE9IcQjlL99SAjxL0KILwshNgA8XQixQwjxKSHEafc4fkt5ftF9zZIQ4i4Aj4n63kKIJwghbnA/+wYhx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dUAHnTP+esB/ELM1yVIcFZABAtiEiRI8HCDEGIfKMjJaoFJggQJEiToIRImK0GCBAkSJEiQoAdIgqwECRIkSJAgQYIeIEkXJkiQIEGCBAkS9AAJk5UgQYIECRIkSNADJEFWggQJEiRIkCBBDzCQHdxnZmbkvn37+n0YCRIkSJAgQYIETXHTTTfNSyln9ccHMsjat28fbrzxxn4fRoIECRIkSJAgQVMIIYwtw5J0YYIECRIkSJAgQQ+QBFkJEiRIkCBBggQ9QBJkJUiQIEGCBAkS9ABJkJUgQYIECRIkSNADJEFWggQJEiRIkCBBD5AEWQkSJEiQIEGCBD1AEmQlSJAgQYIECRL0AEmQlSBBggQJEiRI0AMkQVaCBAkSJEiQIEEPkARZCRIkSJAgQYIEPUASZCVIkCBBggQJEvQASZCVIEFcrJ8CNhb6fRQJEiRIkOAMQRJkJUgQF59+HfClN/b7KBIkSJAgwRmCTL8PIEGCMwbrpwCr2u+jSJAgQYIEZwiSICtBgriol4BMvt9HkSBBggQJzhAk6cIECeKiXgasSr+PIkGCBGcT1k8Df7UHOHpjv48kQRtIgqwECeKiXqJAK0GCBAk2CytHgOoKcPL2fh9JgjaQBFkJEsRFvZRoshIkSLC5qG3Qz1JS2XwmIgmyEiSIA7sOOBZgJUxWggQJNhH1Ev0sL/X3OBK0hSTISpAgDniiS5isBAkSbCYSJuuMRhJkJUgQBzU3yKqXASn7eywJEiQ4e5AEWWc0kiArQYI4YCYLklKHCRIkSLAZ4LknCbLOSCRBVoIEcaBWFSa6rAQJEnSKhQeA9z0DKC1GP89jspo8L4GPG94PrM31+ygAJEFWggTx4DFZSHRZCRIk6BwnbgGO3QTM3xf9vCTIag3rp4EvvQm45b/7fSQAkiArQYJ4UIOss8krq14GbKvfR5EgwcMPvFmrrEY/j+ee6koiVYiD2hr9XD3W3+NwkQRZCRLEQSB
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.64 | Min:0.80 | Min: 3.13 | Min:2.66 |\n",
"| Avg: 0.75 | Avg:0.83 | Avg: 3.91 | Avg:3.19 |\n",
"| Max: 0.83 | Max:0.87 | Max: 4.90 | Max:3.45 |\n",
"'-------------------------------------------------'\n",
" \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlMAAAE/CAYAAABin0ZUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAADxs0lEQVR4nOy9d7gkV3Utvk5VdbzdN9+Jd6JynEESEkIISciACEIYMAbjB8jmYcDY72Ge8QMbB3D2DxsTDBjzDMbYwoABI5OEQEhCCeWcRpPDzaFzVzi/P07tqlPVVdXx3tszU+v75rvTqbq6wjn7rL322oxzjhgxYsSIESNGjBidQVnrHYgRI0aMGDFixDieEQdTMWLEiBEjRowYXSAOpmLEiBEjRowYMbpAHEzFiBEjRowYMWJ0gTiYihEjRowYMWLE6AJxMBUjRowYMWLEiNEF4mAqRowYMULAGNvKGCsyxtQ13Ie3MMZ+uFbfHyNGjOaIg6kYMY4DMMb2McYq9sR+jDH2RcZYTnr9i4wxzhh7je9zH7eff7v9OMkY+xhj7JC9rb2Msb8L+R7696lV+6EtgDGWYox9gTG2nzFWYIw9wBh7he89VzPGnmSMlRljP2GMbZNeY4yxv2KMzdn//poxxoK+i3N+gHOe45yb9mdvYYy9YwV/23b7fGnSPnyFc/6ylfrOGDFidI84mIoR4/jBtZzzHIDdAJ4H4IO+158G8DZ6YE/IvwRgj/SeDwK4CMDFAPIArgLwQND3SP/e29Nf0QbswMc/TmkADgK4AsAQgA8D+A/G2Hb7M+MA/tN+fhTAvQC+Kn3+nQBeC2AXgPMBv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e4Qx9iBj7N6A1xlj7BOMsWcZYw8zu2VEjBgxYsSIESPGiQ6t+VscXBVRMfIKAKfZ/y6BKFu+pMt9ixEjRowYMWLE6Hu0E0xF4ToA/2KXYt/FGBtmjG20S6MDMT4+zrdv396jr48RI0aMGDFixFg53HfffbOc84mg11oNpjiAHzLGOIDPcc7/0ff6ZnhbJhyynwsNprZv3457723IGMaIESNGjBgxYvQdGGOhTddbDaYu45wfYYytA3ATY+xJzrnsrhzUILTBwIox9k6ITvDYunVri18dI0aMGDFixIjRv2hJgM45P2L/nYZo1XCx7y2HAGyRHk/C26OLtvOPnPOLOOcXTUwEMmUxYsSIESNGjBjHFZoGU4yxAcZYnv4P0TrhUd/b/gvAW+2qvhcAWIrSS8WIESNGjBgxYpwoaCXNtx7AN0WTdmgA/o1z/n3G2LsAgHP+WYjmm68E8CyAMoDrV2Z3Y8SIESNGjJMTuq7j0KFDqFara70rJzTS6TQmJyeRSCRa/kzTYMpugLor4PnPSv/nEA1TY8SIESNGjBgrgEOHDiGfz2P79u2wCY4YPQbnHHNzczh06BB27NjR8udiB/QYMWLEiBHjOEC1WsXY2FgcSK0gGGMYGxtrm/2Lg6kYMWLEiBHjOEEcSK08OjnGcTAVI0aMGDFixGgJqqpi9+7dOPfcc3HttddicXERALBv3z4wxvDhD3/Yee/s7CwSiQTe+973AgCeeuopXHnlldi9ezfOOussvPOd7wQA3HLLLRgaGsLu3budfz/60Y8833vJJZdg9+7d2Lp1KyYmJpz37du3r6X9fvDBB/Hd7363+wMQgl45oMeIESNGjBgxTnBkMhk8+OCDAIC3ve1t+PSnP43f//3fBwDs3LkTN954Iz760Y8CAL72ta/hnHPOcT7727/923jf+96H6667DgDwyCOPOK9dfvnluPHGG0O/9+677wYAfPGLX8S9996LT33qU23t94MPPoh7770Xr3zlK9v6XKuImakYMXy449lZ6Ka11rsRI0aMGH2NSy+9FIcPH3YeZzIZnHXWWU53k69+9at44xvf6Lx+9OhRTE5
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"print('KNeighborsRegressor With Vanilla Features')\n",
"run(qt_str,y,KNeighborsRegressor())"
]
},
{
"cell_type": "markdown",
"id": "f0539b99-5d48-4e61-b5ec-0c08a53bbd8a",
"metadata": {},
"source": [
"Nearly identical performance engineered vs vanilla"
]
},
{
"cell_type": "markdown",
"id": "d194490c-6363-4363-b4bc-aaac4e0eeac4",
"metadata": {},
"source": [
"# Tree"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "a6a3c5b4-6d4e-4089-8849-32b371414c15",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T14:49:38.316427Z",
"iopub.status.busy": "2022-08-01T14:49:38.316064Z",
"iopub.status.idle": "2022-08-01T14:49:39.339671Z",
"shell.execute_reply": "2022-08-01T14:49:39.338774Z",
"shell.execute_reply.started": "2022-08-01T14:49:38.316399Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"DecisionTreeRegressor With Engineered Features\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlMAAAF1CAYAAADMXG9eAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAADAO0lEQVR4nOy9eZgtWVXm/e6IOHNON/Pmnavq1q15pJCioKBVRplEnAVpcWoRPxHt5lPpbqduoW27/WyHRktEGuluBQQHFBQFBFRQqoCqoubpzvPNm+OZYjj7+2PH2rEjTpxz4gyZeTJz/Z7nPjczz7RPDHuvvda71hJSSjAMwzAMwzCDYW32ABiGYRiGYbYybEwxDMMwDMMMARtTDMMwDMMwQ8DGFMMwDMMwzBCwMcUwDMMwDDMEbEwxDMMwDMMMARtTDMOMFCHEi4QQpzZ7HJuJEOIeIcTPb/IYHhZCvGgzx8AwOwU2phhmAxFCH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1Of5TeDyM0D1IrDrMDB1CLAMu9hrACun1euTj5lIqca1dgGQgfr8VhD+7Ic/S/U9Z4+o77J6Tn12eU4dOzo2Fx4BLEf9rTAZ/5zGCrByBpg+BBQm1N/cGrB0XH1ODKGeV5rpfE7dGrB8CihOARN7o3NH1JfUsZk+pMYMAI1l9ZpWEH+uZQMzV0XjSsNvqvPrNzo/xymq9+l0bk1aLWDllBonoI7brquAfCX+vMBT5yfw1Lmn70I0ltVxba4CXh1oeeo6yZUBSCDw1d8CV/08uReYv1FdF52+58oZoH5ZvV/gqfM5dVAd4+oldS9NXwHMXNl+3LMgpTo39UV17orT6u/VS0BtQd1z5bnB3rsT1QX13pN7gcKUukfXLqjjNnNlH+fstDqeU4cAJz+68aV+XgA
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.25 | Min:1.00 | Min: 3.53 | Min:0.00 |\n",
"| Avg: 0.59 | Avg:1.00 | Avg: 4.94 | Avg:0.18 |\n",
"| Max: 0.82 | Max:1.00 | Max: 6.49 | Max:0.28 |\n",
"'-------------------------------------------------'\n",
" \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkkAAAE/CAYAAABSE1d1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAACj60lEQVR4nO2dd5idRdn/v3N62bN9szWbnpBGEhJICDWho4CCIIqKiqIgKtiVVwX7+yq2nxRREUUUREGKiPSW0NJ7SN1sstlsL6e3+f0xzzzlnOe0zdmW3J/r4iJ76pynzHzne99zD+OcgyAIgiAIgjBiGe0GEARBEARBjEVIJB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w0nHO8+m4nkkk+2k0piOPKSZIkEgm88MILuO666wyPX3311XjooYdQV1cHq9WKhoYGtLW1AQBuueUWrFy5EsuXL8f555+PT3ziEygvLwcAvPbaa1i4cKH6Of/85z8xbdq0rG24/vrrcc8992DGjBl46623cOONN+LFF1/E9773Pfz3v/9FY2Mj+vr64HA48L3vfW9IDhRBEARBjAW2tg3gY/e9jb9ctxSnz6ge7ebkzaiIpNuf3IptbQNF/cw5DaX47iVzs74mFAqpuUCLFy/GeeedZ3j+wgsvxLe//W3U1tbigx/8oOG5T3ziE7jgggvwzDPP4PHHH8dvf/tbbNy4EUDucFsqfr8fq1evxpVXXqk+FolEAACnnXYaPv7xj+Oqq67C5ZdfnvdnEgRBEMRYZSAUAwAcGRhfq6+Pq3CbzElqaWlBNBrFnXfeaXj
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"print('DecisionTreeRegressor With Engineered Features')\n",
"run(qt_eng,y,DecisionTreeRegressor())"
]
},
{
"cell_type": "markdown",
"id": "1cb7b8cb-f3da-419a-8584-5c619deec302",
"metadata": {},
"source": [
"The tree is quite bad"
]
},
2022-07-21 16:31:53 -04:00
{
"cell_type": "code",
2022-08-01 11:39:46 -04:00
"execution_count": 16,
"id": "ca6ce2a6-5620-4d7a-bcf4-b555ce36e324",
2022-07-21 16:31:53 -04:00
"metadata": {
"execution": {
2022-08-01 11:39:46 -04:00
"iopub.execute_input": "2022-08-01T14:49:39.341245Z",
"iopub.status.busy": "2022-08-01T14:49:39.340853Z",
"iopub.status.idle": "2022-08-01T14:49:40.386890Z",
"shell.execute_reply": "2022-08-01T14:49:40.386176Z",
"shell.execute_reply.started": "2022-08-01T14:49:39.341206Z"
2022-07-21 16:31:53 -04:00
},
"tags": []
},
2022-08-01 11:39:46 -04:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"DecisionTreeRegressor With Vanilla Features\n"
]
},
{
"data": {
"image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IAiCIDJz//33L3DO5+Ie27Rgav/+/bjvvvu6P5EgCIIgCGKTYYwljsqiNB9BEARBEMQAUDBFEARBEAQxABRMEQRBEARBDAAFUwRBEARBEANAwRRBEARBEMQAUDBFEARBEAQxABRMEQRBEARBDAAFUwRBEARBEANAwRRBEARBEMQAdA2mGGMfZoydY4w9nPA4Y4z9PmPsCGPsW4yx5+W/mQRBEARBEKNJFmXqIwC+M+XxVwO4wvvvXQD+ePDNIgiCIAiCuDDoOpuPc34XY2x/ylPeCOCjnHMO4G7G2BRjbAfn/HReG9kXtgk88Tlg7wuAsa3Jz2uvA6cfBFwbKNaA6gwwtR/QvDizvQasnwMmdgFGOfIebeDMw4C5BhTHgEIJsFqAuS4eN6riNSd3A5Wpzr+dfxywmsDWa4DyBMA50FgC2qvi/QpFwLGBpaeA+jwwezkwtg1grPtnP3cYYBqw9QCgG/HPc11g/SzAXWBiZ/fXDf2tAywdBVaeBQpl8TmNmvh/sSr+rWcc/bg+Dzht8ZmTtsE2gcUjQPM8sOVKYCx21mTCtrrAynFg5QQwdw1Qm01+rm0C548Bjim2pTQOTO4Jtkt+P5N7xTHCuXj+2hlg+3VAaaz79nAOrJ4CGgvi+3VMwLXE/0uTwNarxftaTWDhCaCxKI4lowI4lji+9KLYD7Ut4dduLAHzjwHlKWDLFeK7b60A5x4FzLr4O93w/iuKY4RzQNPFMVCeFK/TWgHWzor9XJnu3J8Lj4tzZ/t1wXnRXAZWT4pzybXFMeL/2xZ/N75dbHehKM4tuV3FWnD+WHWgMgNsu7bz2LVNccyN7xDHGSD24fIzQG1OnEcA0FoFzh4
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
".-------------------------------------------------.\n",
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.33 | Min:1.00 | Min: 3.82 | Min:0.00 |\n",
"| Avg: 0.59 | Avg:1.00 | Avg: 4.96 | Avg:0.18 |\n",
"| Max: 0.74 | Max:1.00 | Max: 6.42 | Max:0.28 |\n",
"'-------------------------------------------------'\n",
" \n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkkAAAE/CAYAAABSE1d1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAACf9ElEQVR4nO2dd5icVdn/v2f6zPa+2d1sekIaqaTRQg9KURREfRXBV1RUbK+++rMhltdeUBQLih0ElC6d0BICSQghjfRNdjeb7W16Ob8/7uc888zMM2V3Z7Obzf25rr2S6ecp55zvudsRUkowDMMwDMMwiVjGugEMwzAMwzDjERZJDMMwDMMwJrBIYhiGYRiGMYFFEsMwDMMwjAkskhiGYRiGYUxgkcQwDMMwDGMCiySGYU5JhBCNQohBIYR1DNvwfiHEk2P1+wzDZIZFEsOMMUKIw0IIvzZhtwkh7hJCFBpev0sIIYUQVyR97mfa8x/SHjuEED8WQjRr33VICPHTNL+j/n55wg40B4QQTiHEnUKIJiHEgBDidSHEpUnvuUAIsUcI4RNCPCeEmGJ4TQghvi+E6NL+fiCEEGa/JaU8IqUslFJGtc+uF0L89yge21TtetkMbfiblPLi0fpNhmFGBoskhhkfXC6lLASwGMASAF9Oen0vgOvUA22ivRrAAcN7vgxgOYAVAIoAnAfgdbPfMfx9Mq9HMQQ0QZM8BtkAHAVwLoASAF8D8E8hxFTtM5UA/qU9Xw5gM4B7DJ+/EcA7ACwCcDqAywB8dNQOwsBYWqQYhhkdWCQxzDhCStkG4AmQWDLyMIAzhRBl2uN1ALYDaDO85wwA/5ZStkrisJTyz8Nph2bR+ZkQolX7+5kQwqm9tlsIcZnhvTYhRKcQYqn2eJUQYoMQolcI8YYQYq3hveuFEN8RQrwMwAdgetLxe6WUt2htj0kpHwFwCMAy7S1X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kcQwDMMwzJAYCETw0v5OxGJyrJsyqrBIYnLmX1ubcbBjcKybwTAMw4wxwUgMvb4wdh3rH+umjCoskpickFLii/dtx92vHR3rpjAMwzBjSCwmEYrGAAAv7e8c49aMLiySmJwIRmKIxCSC4ehYN4VhGIYZQ5RAAoCXWSQxDDAYjAAgscQwDMOcugTDNA+47Ba8eqgbgQm8eGaRxOSEl0USwzAMAyAYIVF01sxKBCMxbGnqGeMWjR4skpic8AapU6jOwTAMw5yaqMXy2bOqYLOICR2XxCKJyQlvSLMkhdmSxDAMcyqjFsvlBQ4saSyd0HFJLJKYnGB3G8MwDAMAAW2x7LRZcObMSrzZ0oc+X3iMWzU6sEhicoLdbQzDMAwQXyw77VZMryqElEDH4MTcooRFEpMTbEkaX/hCEUg5sSvdMgwzPlGLZafNAo/dCgDwhSbmAppFEpMTHJM0fjjc6cUZ334a929tGeumMAxzCqJbkmwWeBwkkpS3YaKRk0gSQpQKIe4TQuwRQuwWQqwe7YYx44u4JWlidoSTBSklbnl4J7yhKNr6/GPdHIZhTkFUUWGnzQq3JpL84chYNmnUsOX4vp8DeFxK+W4hhAOAZxTbxIxDBvWYJLYkjSVP7TqO9W91AOBrwTDM2BCPSbLAahEATmF3mxCiGMA5AO4EACllSErZO8rtYsYZvhDHJI01/lAU33x4F2bXFMJps0zoKrcMw4xfguFUd9spK5IATAfQAeCPQojXhRC/F0IUJL9JCHGjEGKzEGJzR0dH3hvKjC36tiQ8MY8Zf954GC29ftx65QK4HVYWrAzDjAnxwG2rLpL8p7BIsgFYCuDXUsolALwAvpT8Jinlb6WUy6WUy6uqqvLcTGasOZWy2waDEXQOBse6GSnsax/EpBIXVk2vgNNm4SB6hmHGBKO7zeOgqJ1T2ZLUDKBZSrlJe3wfSDQxpxC
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
2022-07-21 16:31:53 -04:00
"source": [
2022-08-01 11:39:46 -04:00
"print('DecisionTreeRegressor With Vanilla Features')\n",
"run(qt_str,y,DecisionTreeRegressor())"
]
},
{
"cell_type": "markdown",
"id": "a9e31adc-22c5-4c77-bc25-a2000535cb1d",
"metadata": {},
"source": [
"Not quite sure what's going on here but I don't think this one is going to work"
]
},
{
"cell_type": "markdown",
"id": "508fbf7a-6006-40e7-8f87-a218743ac33d",
"metadata": {},
"source": [
"# Conclusion"
]
},
{
"cell_type": "markdown",
"id": "67f5823f-4d25-4e75-95a0-b11249d861e8",
"metadata": {},
"source": [
"After testing lots of models, scalers, and experimenting with different mixtures of features, I've come to the conclusion that it's futile.\n",
2022-07-21 16:31:53 -04:00
"\n",
2022-08-01 11:39:46 -04:00
"It's cliché, but at under 400 rows I think I can complain about not having enough data.\n",
"\n",
"QuantileTransformer is the heavy lifter and the model really doesn't seem to matter so long as it's linear. In fact, the scores go down as the models get fancier. I think because it's overthinking such a small data set, it's making connections that are coincidental.\n",
"\n",
"The best metric I found was to make predictions on my own vehicles, in other words it's unseen data that I could just pull from nothing. I had used model year as a feature and it seemed to perform quite well until I introduced a 2012, it predicted MPG into the hundreds. I think model year would be a great feature if the data spanned across decades and there was good representation. It could probably even be made categorical as it would be an indicator of tech advancing over decades. All of the vehicles here are more or less in the same \"tech era\" but the model did seem to find a signal. At any rate it's too unstable if used with data outside the training set.\n",
"\n",
"My personal vehicle predictions are actually quite close. They're a bit on the lower end, but also consider that neither one is even close to being represented in the training data. My truck is a turbo diesel (boost to efficiency) and my car is gas but has some fancy cam phasing and electronic fuel injection. Basically they have higher efficiency compared to anything in the training set."
]
},
{
"cell_type": "markdown",
"id": "4f578d1a-dd8b-45b2-920e-2422edba75b9",
"metadata": {},
"source": [
"# Unseen Data"
]
},
{
"cell_type": "markdown",
"id": "854f2789-c761-4d7d-90e4-63a53f97de1c",
"metadata": {},
"source": [
"I tried to incorporate my unseen data for predictions into the rewrite for modeling but it didn't work and I'm out of both time and energy and beginning to lose my sanity. So here's the old code to prove it works, first with engineered features:"
2022-07-21 16:31:53 -04:00
]
},
{
"cell_type": "code",
2022-08-01 11:39:46 -04:00
"execution_count": 20,
"id": "86675084-0072-443a-8963-952c0656148e",
2022-07-21 16:31:53 -04:00
"metadata": {
"execution": {
2022-08-01 11:39:46 -04:00
"iopub.execute_input": "2022-08-01T15:09:39.581456Z",
"iopub.status.busy": "2022-08-01T15:09:39.580870Z",
"iopub.status.idle": "2022-08-01T15:09:44.322330Z",
"shell.execute_reply": "2022-08-01T15:09:44.321392Z",
"shell.execute_reply.started": "2022-08-01T15:09:39.581427Z"
2022-07-21 16:31:53 -04:00
},
"tags": []
},
"outputs": [
{
"data": {
2022-08-01 11:39:46 -04:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAF1CAYAAADbfv+XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9d5hdV3k1vvY55/Y2Xd0qtmTLkm0ZG2NjEkwxEDA1oQcSwhfCL/BBeiN8SQgQkpB8iRMDgQT8QcD0ZiDYNGMMNi5YLrJsy+qjGU27c3s5bf/+ePfe55xbZu5I0ySd9Tx6RjO3nL732utd7/syzjlChAgRIkSIECFCLC60ld6BECFChAgRIkSIsxEhyQoRIkSIECFChFgChCQrRIgQIUKECBFiCRCSrBAhQoQIESJEiCVASLJChAgRIkSIECGWACHJChEiRIgQIUKEWAKEJCtEiBDLBsbYdYyx0ZXej5UEY+xjjLH3rvA+7GOMXbeS+xAixLmAkGSFCLFKwBg7whirM8YqjLGTjLGbGWPpld6vcwGMsZcwxu5ijBXEuf8EYyzjez3GGPskY6wkXv+Dls/vYYw9wBiriZ97um2Lc/52zvnfis8tOekU99H7W/ZhF+f8jqXcbogQIUKSFSLEasNLOedpAHsAXA7gz1d2d+YGY0xf6X1YKBhjRoc/5wC8H8B6ADsBbATwj77X/xrAdgCbATwHwJ8wxl4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7z1rW9te+3ee++FaZo4//zz5/2eD3zgA3juc5+LT37ykygUCrjqqqvw/Oc/Hx/72Mfw7ne/G2984xthmiY
2022-07-21 16:31:53 -04:00
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
2022-08-01 11:39:46 -04:00
"| Min: 0.59 | Min:0.71 | Min: 3.04 | Min:3.71 |\n",
"| Avg: 0.73 | Avg:0.74 | Avg: 4.04 | Avg:3.96 |\n",
"| Max: 0.83 | Max:0.77 | Max: 4.72 | Max:4.27 |\n",
2022-07-21 16:31:53 -04:00
"\n"
]
},
{
"data": {
2022-08-01 11:39:46 -04:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlkAAAE/CAYAAAB1vdadAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAAsTAAALEwEAmpwYAAEAAElEQVR4nOy9d5gkV3k1fm5VdQ6Tw+ZdrVYBSewqgEAgEGCQMMkm29gE830yYMDG2P7sn42NsXHCYIzBCBubZLBEsBEIkASIFSCBUFpJK21e7WrD5JmezhXv7497b9Wt6qrunrQ7I9V5nn12prt6+nZ11b3nnve870sopYgRI0aMGDFixIixvFDO9gBixIgRI0aMGDGejIhJVowYMWLEiBEjxgogJlkxYsSIESNGjBgrgJhkxYgRI0aMGDFirABikhUjRowYMWLEiLECiElWjBgxYsSIESPGCiAmWTFixIixCBBCNhNCqoQQ9SyO4U2EkNvP1vvHiBGjPWKSFSPGGgch5BghpMEX/HFCyOcJIXnp+c8TQigh5JWB132cP/5W/nuSEPJRQshJ/rceJ4T8U8T7iH+fPGMftAsQQlKEkP8ghBwnhFQIIQ8SQl4aOOZFhJD9hJA6IeRHh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+96HPXv2YN++fXjPe97jPnf11Vdjz5497r9f+qVf8r3vPffcgz179uBDH/oQ3vCGN7jHdds15qyTLErpn1BKN1JKt4KRqDsopb8RPI4Q0gPg+QBulh7LEUIK4mcALwGwd5nGHiPGUw6HJ6s4MVs/28OIESNGjEg8+9nPxqlTp9zfM5kMLrzwQreTy0033YTXv/717vNjY2PYuHGj+/sll1y
2022-07-21 16:31:53 -04:00
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
2022-08-01 11:39:46 -04:00
"f250 turbo diesel Avg: 13.80\n",
"2012 Mustang V8 Avg: 15.80\n",
"2022 Honda Grom Avg: 37.12\n",
"2011 Chevrolet Suburban Avg: 14.37\n",
"2014 Toyota Corolla Avg: 19.17\n",
"2004 Mustang V6 Avg: 15.17\n"
2022-07-21 16:31:53 -04:00
]
}
],
"source": [
2022-08-01 11:39:46 -04:00
"X = pd.read_csv('data/X_engineered.csv')\n",
2022-07-21 16:31:53 -04:00
"y = pd.read_csv('data/y.csv').mpg\n",
"\n",
"eff = 1\n",
"\n",
"v6_s197_05_hp = 216\n",
"v6_s197_05_ci = 245\n",
"v6_s197_05_cl = 6\n",
"v6_s197_05_weight = 3300\n",
"v6_s197_05_eff = (v6_s197_05_hp/\\\n",
" v6_s197_05_ci)*eff\n",
"v6_s197_05 = {'horsepower':v6_s197_05_hp,\n",
" 'bore_size':v6_s197_05_ci/v6_s197_05_cl,\n",
" 'grunt':(v6_s197_05_ci/v6_s197_05_cl)/v6_s197_05_eff,\n",
" 'load':v6_s197_05_ci/v6_s197_05_weight}\n",
"mustang_hp = 400\n",
"mustang_ci = 302\n",
"mustang_cl = 8\n",
"mustang_weight = 3600\n",
"mustang_eff = (mustang_hp/\\\n",
" mustang_ci)*eff\n",
"mustang = {'horsepower':mustang_hp,\n",
" 'bore_size':mustang_ci/mustang_cl,\n",
" 'grunt':(mustang_ci/mustang_cl)/mustang_eff,\n",
" 'load':mustang_ci/mustang_weight}\n",
"corolla_hp = 140\n",
"corolla_ci = 110\n",
"corolla_cl = 4\n",
"corolla_weight = 2800\n",
"corolla_eff = (corolla_hp/\\\n",
" corolla_ci)*eff\n",
"corolla = {'horsepower':corolla_hp,\n",
" 'bore_size':corolla_ci/corolla_cl,\n",
" 'grunt':(corolla_ci/corolla_cl)/corolla_eff,\n",
" 'load':corolla_ci/corolla_weight}\n",
"truck_hp = 500\n",
"truck_ci = 359\n",
"truck_cl = 6\n",
"truck_weight = 6500\n",
"truck_eff = (truck_hp/\\\n",
" truck_ci)*eff\n",
"truck = {'horsepower':truck_hp,\n",
" 'bore_size':truck_ci/truck_cl,\n",
" 'grunt':(truck_ci/truck_cl)/truck_eff,\n",
" 'load':truck_ci/truck_weight}\n",
"grom_hp = 12\n",
"grom_ci = 7.6\n",
"grom_cl = 1\n",
"grom_weight = 400\n",
"grom_eff = (grom_hp/\\\n",
" grom_ci)*eff\n",
"grom = {'horsepower':grom_hp,\n",
" 'bore_size':grom_ci/grom_cl,\n",
" 'grunt':(grom_ci/grom_cl)/grom_eff,\n",
" 'load':grom_ci/grom_weight}\n",
"burb_hp = 320\n",
"burb_ci = 325\n",
"burb_cl = 8\n",
"burb_weight = 6000\n",
"burb_eff = (burb_hp/\\\n",
" burb_ci)*eff\n",
"burb = {'horsepower':burb_hp,\n",
" 'bore_size':burb_ci/burb_cl,\n",
" 'grunt':(burb_ci/burb_cl)/burb_eff,\n",
" 'load':burb_ci/burb_weight}\n",
"\n",
"mdf = pd.DataFrame(mustang,index=[0])\n",
"cdf = pd.DataFrame(corolla,index=[0])\n",
"tdf = pd.DataFrame(truck,index=[0])\n",
"gdf = pd.DataFrame(grom,index=[0])\n",
"bdf = pd.DataFrame(burb,index=[0])\n",
"sm5 = pd.DataFrame(v6_s197_05,index=[0])\n",
"\n",
"mustang_predicts = []\n",
"corolla_predicts = []\n",
"truck_predicts = []\n",
"grom_predicts = []\n",
"burb_predicts = []\n",
"v6_s197_05_predicts = []\n",
"\n",
"r2_test_list = []\n",
"r2_train_list = []\n",
"rmse_test_list = []\n",
"rmse_train_list = []\n",
"\n",
"for i in range(201):\n",
" X_train, X_test, y_train, y_test = train_test_split(X, y)\n",
"\n",
" pipe = Pipeline([\n",
" # ('minmax', MinMaxScaler()),\n",
" # ('ss', StandardScaler()),\n",
" ('qt', QuantileTransformer(n_quantiles=297)),\n",
" # ('rob', RobustScaler()),\n",
" \n",
" ('linreg', LinearRegression()),\n",
" # ('lasso', Lasso()),\n",
" # ('lassocv', LassoCV()),\n",
" # ('ridge', Ridge()),\n",
" # ('ridgeCV', RidgeCV),\n",
" # ('lsvr', LinearSVR())\n",
" ])\n",
"\n",
" model = pipe.fit(X_train,y_train)\n",
" test_predict = model.predict(X_test)\n",
" train_predict = model.predict(X_train)\n",
"\n",
" r2_test = r2_score(y_test, test_predict)\n",
" r2_train = r2_score(y_train, train_predict)\n",
" rmse_test = mean_squared_error(y_test, test_predict ,squared=False)\n",
" rmse_train = mean_squared_error(y_train, train_predict ,squared=False)\n",
"\n",
" r2_test_list.append(r2_test)\n",
" r2_train_list.append(r2_train)\n",
" rmse_test_list.append(rmse_test)\n",
" rmse_train_list.append(rmse_train)\n",
" truck_predicts.append(model.predict(tdf)[0])\n",
" mustang_predicts.append(model.predict(mdf)[0])\n",
" grom_predicts.append(model.predict(gdf)[0])\n",
" burb_predicts.append(model.predict(bdf)[0])\n",
" corolla_predicts.append(model.predict(cdf)[0])\n",
" v6_s197_05_predicts.append(model.predict(sm5)[0])\n",
"\n",
"plt.subplots(figsize=(10,6))\n",
"plt.title('R-squared over 200 iterations')\n",
"plt.plot(r2_test_list,label='R2 Test')\n",
"plt.plot(r2_train_list,label='R2 Train')\n",
"plt.legend()\n",
"plt.show();\n",
"\n",
"avg = np.mean\n",
"print(f'''| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: {min(r2_test_list):.2f} | Min:{min(r2_train_list):.2f} | Min: {min(rmse_test_list):.2f} | Min:{min(rmse_train_list):.2f} |\n",
"| Avg: {avg(r2_test_list):.2f} | Avg:{avg(r2_train_list):.2f} | Avg: {avg(rmse_test_list):.2f} | Avg:{avg(rmse_train_list):.2f} |\n",
"| Max: {max(r2_test_list):.2f} | Max:{max(r2_train_list):.2f} | Max: {max(rmse_test_list):.2f} | Max:{max(rmse_train_list):.2f} |\n",
"''')\n",
"plt.subplots(figsize=(10,5))\n",
"plt.title('RMSE over 200 iterations')\n",
"plt.plot(rmse_test_list,label='RMSE Test')\n",
"plt.plot(rmse_train_list,label='RMSE Train')\n",
"plt.legend()\n",
"plt.show();\n",
"\n",
2022-08-01 11:39:46 -04:00
"print(f'f250 turbo diesel Avg: {avg(truck_predicts):.2f}')\n",
"print(f'2012 Mustang V8 Avg: {avg(mustang_predicts):.2f}')\n",
"print(f'2022 Honda Grom Avg: {avg(grom_predicts):.2f}')\n",
"print(f'2011 Chevrolet Suburban Avg: {avg(burb_predicts):.2f}')\n",
"print(f'2014 Toyota Corolla Avg: {avg(corolla_predicts):.2f}')\n",
"print(f'2004 Mustang V6 Avg: {avg(v6_s197_05_predicts):.2f}')"
2022-07-21 16:31:53 -04:00
]
},
{
"cell_type": "markdown",
2022-08-01 11:39:46 -04:00
"id": "89e10849-d1b2-40ce-8325-acc472d5dc1c",
2022-07-21 16:31:53 -04:00
"metadata": {},
"source": [
2022-08-01 11:39:46 -04:00
"and with straight:"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "a95d6a9f-f76d-4965-8a8f-c6a8b4774311",
"metadata": {
"execution": {
"iopub.execute_input": "2022-08-01T15:10:15.600302Z",
"iopub.status.busy": "2022-08-01T15:10:15.599550Z",
"iopub.status.idle": "2022-08-01T15:10:20.329138Z",
"shell.execute_reply": "2022-08-01T15:10:20.328104Z",
"shell.execute_reply.started": "2022-08-01T15:10:15.600272Z"
},
"tags": []
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KG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WhRCi6zJrNgRpYWFhYWFhYXGGYQmYhYWFhYWFhcUZhiVgFhYWFhYWFhZnGGeVB8zCwsLCwsLizMDzPA4dOkSj0VjtU1nzKJVK7Nixg3w+3/N3LAGzsLCwsLCw6MChQ4cYGBhg586dCCFW+3TWLKSUTExMcOjQIS688MKev2dDkBYWFhYWFhYdaDQajI2NWfK1CIQQjI2NLVkptATMwsLCwsLCIhOWfPWGU7lPloBZWFhYWFhYrEm4rsuuXbu4+uqrefnLX8709DQAu3fv5ulPfzpXXXUV1157LR/72Mc6vvvmN7+ZXbt28aQnPYlyucyuXbvYtWsXn/jEJ3o69vT0NO9+97uX83JS6ImACSFeJIR4WAixVwjx1ozPh4QQnxNC3COE2COE+OXEZ/uFEPcJIXYLIe5IvD8qhPiqEOJR/TqyPJdkYWFhYWFhsR5QLpfZvXs3999/P6Ojo9x8880AVCoVPvjBD7Jnzx6+9KUv8Zu/+ZsROTO4+eab2b17N1/4whe4+OKL2b17N7t37+ZVr3pVT8dedQImhHCBm4EXA08CXiOEeFLbZm8GHpBSXgc8G/grIUQh8flzpJS7pJQ3Jt57K3CrlPJS4Fb9t4WFhYWFhYVFB57+9Kdz+PBhAC677DIuvfRSALZt28amTZs4efLkovuoVqv8yq/8Ck95ylO4/vrr+cxnPgPAnj17uOmmm9i1axfXXnstjz76KG9961t57LHH2LVrF7/zO7+z7NfTSxbkTcBeKeU+ACHER4FXAA8ktpHAgFBB0H5gEvAX2e8rUGQN4F+AbwK/1+uJW1hYWFhYWJwZ/K/P7eGBI7PLus8nbRvkj19+VU/
"text/plain": [
"<Figure size 720x432 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: 0.66 | Min:0.72 | Min: 2.97 | Min:3.51 |\n",
"| Avg: 0.74 | Avg:0.75 | Avg: 3.93 | Avg:3.86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GQUjIyMsLhw4fZsGHDjF4ThQsjRIgQIUKEkxilUomenp6IYC0whBD09PTMSjGcEckSQuwXQjwqhNghhGiorSAUPimE2C2EeEQIcUHguWuEEDvd5/5qxnsWIUKECBEiRJgRIoJ1YjDb8zwbJesFUsptUsqLQp57CbDZ/bkO+G93Z0zgevf5c4A3CCHOmdUeRogQIUKECBGWNEzTZNu2bZx77rm8/OUvZ3x8HID9+/cjhOCDH/ygt+3w8DDxeJx3v/vdAOzcuZMrr7ySbdu2cfbZZ3PdddcBcPvtt9PR0cG2bdu8n5///Oc1n3vxxRezbds21q1bR19fn7fd/v37Z7TfO3bs4Ec/+tHcT0ATzJcn61rgK1JKCdwrhOgUQqwE1gO7pZR7AYQQN7jbPjFPnxshQoQIESJEWGSk02l27NgBwJvf/Gauv/56PvCBDwCwceNGbrnlFj7ykY8A8K1vfYstW7Z4r33Pe97De9/7Xq699loAHn30Ue+5yy67jFtuuaXp5/7mN78B4Etf+hLbt2/nU5/61Kz2e8eOHWzfvp3f/u3fntXrZoqZKlkSuFUI8YAQ4rqQ51cDhwL/H3Yfa/Z4A4QQ1wkhtgshtg8NDc1wtyJEiBAhQoTjx/7hPPuH84u9G88oPPe5z+XIkSPe/+l0mrPPPtvr5HLjjTfy2te+1nv+6NGjrFmzxvv/vPPOm9Pn79mzh2uuuYYLL7yQyy67jKeeegpQ5O7cc89l69atXH755VQqFT70oQ9x4403sm3bNm688cY5fW4YZqpkXSql7BdCLAN+JoR4Skr5q8DzYUFKOcXjjQ9K+VngswAXXXRR6DYRIkSIECHCfOKDNz+GlPC1P7x4sXflGQHbtrntttt4+9vfXvP461//em6
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"f250 turbo diesel Avg: 11.85\n",
"2012 Mustang V8 Avg: 14.84\n",
"2022 Honda Grom Avg: 35.66\n",
"2011 Chevrolet Suburban Avg: 11.76\n",
"2014 Toyota Corolla Avg: 21.13\n",
"2004 Mustang V6 Avg: 16.28\n"
]
}
],
"source": [
"X = pd.read_csv('data/X_straight.csv')\n",
"y = pd.read_csv('data/y.csv').mpg\n",
2022-07-21 16:31:53 -04:00
"\n",
2022-08-01 11:39:46 -04:00
"v6_s197_05 = {'horsepower':216,\n",
" 'weight':3300,\n",
" 'displacement':245,\n",
" 'cylinders':6}\n",
2022-07-21 16:31:53 -04:00
"\n",
2022-08-01 11:39:46 -04:00
"mustang = {'horsepower':400,\n",
" 'weight':3600,\n",
" 'displacement':302,\n",
" 'cylinders':8}\n",
2022-07-21 16:31:53 -04:00
"\n",
2022-08-01 11:39:46 -04:00
"corolla = {'horsepower':140,\n",
" 'weight':2800,\n",
" 'displacement':110,\n",
" 'cylinders':4}\n",
2022-07-21 16:31:53 -04:00
"\n",
2022-08-01 11:39:46 -04:00
"truck = {'horsepower':500,\n",
" 'weight':6500,\n",
" 'displacement':359,\n",
" 'cylinders':6}\n",
"\n",
"grom = {'horsepower':12,\n",
" 'weight':400,\n",
" 'displacement':7.6,\n",
" 'cylinders':1}\n",
"\n",
"burb = {'horsepower':320,\n",
" 'weight':6000,\n",
" 'displacement':325,\n",
" 'cylinders':8}\n",
"\n",
"mdf = pd.DataFrame(mustang,index=[0])\n",
"cdf = pd.DataFrame(corolla,index=[0])\n",
"tdf = pd.DataFrame(truck,index=[0])\n",
"gdf = pd.DataFrame(grom,index=[0])\n",
"bdf = pd.DataFrame(burb,index=[0])\n",
"sm5 = pd.DataFrame(v6_s197_05,index=[0])\n",
"\n",
"mustang_predicts = []\n",
"corolla_predicts = []\n",
"truck_predicts = []\n",
"grom_predicts = []\n",
"burb_predicts = []\n",
"v6_s197_05_predicts = []\n",
"\n",
"r2_test_list = []\n",
"r2_train_list = []\n",
"rmse_test_list = []\n",
"rmse_train_list = []\n",
"\n",
"for i in range(201):\n",
" X_train, X_test, y_train, y_test = train_test_split(X, y)\n",
"\n",
" pipe = Pipeline([\n",
" # ('minmax', MinMaxScaler()),\n",
" # ('ss', StandardScaler()),\n",
" ('qt', QuantileTransformer(n_quantiles=297)),\n",
" # ('rob', RobustScaler()),\n",
" \n",
" ('linreg', LinearRegression()),\n",
" # ('lasso', Lasso()),\n",
" # ('lassocv', LassoCV()),\n",
" # ('ridge', Ridge()),\n",
" # ('ridgeCV', RidgeCV),\n",
" # ('lsvr', LinearSVR())\n",
" ])\n",
"\n",
" model = pipe.fit(X_train,y_train)\n",
" test_predict = model.predict(X_test)\n",
" train_predict = model.predict(X_train)\n",
"\n",
" r2_test = r2_score(y_test, test_predict)\n",
" r2_train = r2_score(y_train, train_predict)\n",
" rmse_test = mean_squared_error(y_test, test_predict ,squared=False)\n",
" rmse_train = mean_squared_error(y_train, train_predict ,squared=False)\n",
"\n",
" r2_test_list.append(r2_test)\n",
" r2_train_list.append(r2_train)\n",
" rmse_test_list.append(rmse_test)\n",
" rmse_train_list.append(rmse_train)\n",
" truck_predicts.append(model.predict(tdf)[0])\n",
" mustang_predicts.append(model.predict(mdf)[0])\n",
" grom_predicts.append(model.predict(gdf)[0])\n",
" burb_predicts.append(model.predict(bdf)[0])\n",
" corolla_predicts.append(model.predict(cdf)[0])\n",
" v6_s197_05_predicts.append(model.predict(sm5)[0])\n",
"\n",
"plt.subplots(figsize=(10,6))\n",
"plt.title('R-squared over 200 iterations')\n",
"plt.plot(r2_test_list,label='R2 Test')\n",
"plt.plot(r2_train_list,label='R2 Train')\n",
"plt.legend()\n",
"plt.show();\n",
"\n",
"avg = np.mean\n",
"print(f'''| R2 Test | R2 Train | RMSE Test | RMSE Train |\n",
"|-----------|----------|-------------|------------|\n",
"| Min: {min(r2_test_list):.2f} | Min:{min(r2_train_list):.2f} | Min: {min(rmse_test_list):.2f} | Min:{min(rmse_train_list):.2f} |\n",
"| Avg: {avg(r2_test_list):.2f} | Avg:{avg(r2_train_list):.2f} | Avg: {avg(rmse_test_list):.2f} | Avg:{avg(rmse_train_list):.2f} |\n",
"| Max: {max(r2_test_list):.2f} | Max:{max(r2_train_list):.2f} | Max: {max(rmse_test_list):.2f} | Max:{max(rmse_train_list):.2f} |\n",
"''')\n",
"plt.subplots(figsize=(10,5))\n",
"plt.title('RMSE over 200 iterations')\n",
"plt.plot(rmse_test_list,label='RMSE Test')\n",
"plt.plot(rmse_train_list,label='RMSE Train')\n",
"plt.legend()\n",
"plt.show();\n",
"\n",
"print(f'f250 turbo diesel Avg: {avg(truck_predicts):.2f}')\n",
"print(f'2012 Mustang V8 Avg: {avg(mustang_predicts):.2f}')\n",
"print(f'2022 Honda Grom Avg: {avg(grom_predicts):.2f}')\n",
"print(f'2011 Chevrolet Suburban Avg: {avg(burb_predicts):.2f}')\n",
"print(f'2014 Toyota Corolla Avg: {avg(corolla_predicts):.2f}')\n",
"print(f'2004 Mustang V6 Avg: {avg(v6_s197_05_predicts):.2f}')"
]
},
{
"cell_type": "markdown",
"id": "7fc0e859-e882-44be-a815-19f74b473c18",
"metadata": {},
"source": [
"Predictions are low but relative to each other make sense. For instance they all rank as they should, first the trucks, then the Mustangs, then the Corolla ahead by a decent amount, and then the Grom way out ahead.\n",
"\n",
"There is no real signal of technology here, I would like to get some more data into the future to use model_year as a feature, it gave a nice boost to the scores but when given a 2000s vehicle after being trained on 70s data it predicted MPG around 600 or so.\n",
"\n",
"Each of these predictions should be scaled up by about 30-40% with the exception of the Grom which should be around like 120MPG at least. But the grom is so far off from anything in the training set that I can't complain too much"
2022-07-21 16:31:53 -04:00
]
2022-08-01 11:39:46 -04:00
},
{
"cell_type": "code",
"execution_count": null,
"id": "8759ef99-0bc2-4a80-b83b-d0b909ee3ce4",
"metadata": {},
"outputs": [],
"source": []
2022-07-21 16:31:53 -04:00
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}