Advertisement
sepi0l

dl_boston

Apr 25th, 2024
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 19.88 KB | None | 0 0
  1. {
  2.  "cells": [
  3.   {
  4.    "attachments": {},
  5.    "cell_type": "markdown",
  6.    "metadata": {},
  7.    "source": [
  8.     "# ASSIGNMENT - 1"
  9.    ]
  10.   },
  11.   {
  12.    "cell_type": "code",
  13.    "execution_count": 1,
  14.    "metadata": {},
  15.    "outputs": [
  16.     {
  17.      "name": "stderr",
  18.      "output_type": "stream",
  19.      "text": [
  20.       "c:\\Users\\soniv\\anaconda3\\lib\\site-packages\\numpy\\_distributor_init.py:30: UserWarning: loaded more than 1 DLL from .libs:\n",
  21.       "c:\\Users\\soniv\\anaconda3\\lib\\site-packages\\numpy\\.libs\\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll\n",
  22.       "c:\\Users\\soniv\\anaconda3\\lib\\site-packages\\numpy\\.libs\\libopenblas64__v0.3.21-gcc_10_3_0.dll\n",
  23.       "  warnings.warn(\"loaded more than 1 DLL from .libs:\"\n"
  24.      ]
  25.     }
  26.    ],
  27.    "source": [
  28.     "from tensorflow import keras as tf_keras\n",
  29.     "import numpy as np \n",
  30.     "import pandas as pd \n",
  31.     "from keras.layers import Dense\n",
  32.     "from keras.models import Sequential"
  33.    ]
  34.   },
  35.   {
  36.    "cell_type": "code",
  37.    "execution_count": 2,
  38.    "metadata": {},
  39.    "outputs": [
  40.     {
  41.      "name": "stdout",
  42.      "output_type": "stream",
  43.      "text": [
  44.       "Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/boston_housing.npz\n",
  45.       "57026/57026 [==============================] - 0s 2us/step\n"
  46.      ]
  47.     }
  48.    ],
  49.    "source": [
  50.     "(X_train, y_train), (X_test, y_test)  = tf_keras.datasets.boston_housing.load_data(\n",
  51.     "    path=\"boston_housing.npz\", test_split=0.2, seed=42\n",
  52.     ")"
  53.    ]
  54.   },
  55.   {
  56.    "cell_type": "code",
  57.    "execution_count": 3,
  58.    "metadata": {},
  59.    "outputs": [
  60.     {
  61.      "name": "stdout",
  62.      "output_type": "stream",
  63.      "text": [
  64.       "(404, 13) <class 'numpy.ndarray'>\n",
  65.       "(404,) <class 'numpy.ndarray'>\n",
  66.       "(102, 13) <class 'numpy.ndarray'>\n",
  67.       "(102,) <class 'numpy.ndarray'>\n"
  68.      ]
  69.     }
  70.    ],
  71.    "source": [
  72.     "print(X_train.shape, type(X_train))\n",
  73.     "print(y_train.shape, type(y_train))\n",
  74.     "print(X_test.shape, type(X_test))\n",
  75.     "print(y_test.shape, type(y_test))"
  76.    ]
  77.   },
  78.   {
  79.    "cell_type": "markdown",
  80.    "metadata": {
  81.     "papermill": {
  82.      "duration": 0.052899,
  83.      "end_time": "2020-10-07T20:56:02.160829",
  84.      "exception": false,
  85.      "start_time": "2020-10-07T20:56:02.107930",
  86.      "status": "completed"
  87.     },
  88.     "tags": []
  89.    },
  90.    "source": [
  91.     "<a id  = 'NN'></a>\n",
  92.     "## Neural Networks"
  93.    ]
  94.   },
  95.   {
  96.    "cell_type": "code",
  97.    "execution_count": 4,
  98.    "metadata": {
  99.     "execution": {
  100.      "iopub.execute_input": "2020-10-07T20:56:02.279947Z",
  101.      "iopub.status.busy": "2020-10-07T20:56:02.279001Z",
  102.      "iopub.status.idle": "2020-10-07T20:56:02.291535Z",
  103.      "shell.execute_reply": "2020-10-07T20:56:02.290743Z"
  104.     },
  105.     "papermill": {
  106.      "duration": 0.077294,
  107.      "end_time": "2020-10-07T20:56:02.291688",
  108.      "exception": false,
  109.      "start_time": "2020-10-07T20:56:02.214394",
  110.      "status": "completed"
  111.     },
  112.     "tags": []
  113.    },
  114.    "outputs": [],
  115.    "source": [
  116.     "#Scaling the dataset\n",
  117.     "from sklearn.preprocessing import StandardScaler\n",
  118.     "sc = StandardScaler()\n",
  119.     "X_train = sc.fit_transform(X_train)\n",
  120.     "X_test = sc.transform(X_test)"
  121.    ]
  122.   },
  123.   {
  124.    "cell_type": "code",
  125.    "execution_count": 5,
  126.    "metadata": {},
  127.    "outputs": [],
  128.    "source": [
  129.     "X_train = pd.DataFrame(X_train)\n",
  130.     "X_test = pd.DataFrame(X_test)"
  131.    ]
  132.   },
  133.   {
  134.    "cell_type": "code",
  135.    "execution_count": 6,
  136.    "metadata": {
  137.     "execution": {
  138.      "iopub.execute_input": "2020-10-07T20:56:02.521142Z",
  139.      "iopub.status.busy": "2020-10-07T20:56:02.520202Z",
  140.      "iopub.status.idle": "2020-10-07T20:56:02.813516Z",
  141.      "shell.execute_reply": "2020-10-07T20:56:02.812803Z"
  142.     },
  143.     "papermill": {
  144.      "duration": 0.36162,
  145.      "end_time": "2020-10-07T20:56:02.813669",
  146.      "exception": false,
  147.      "start_time": "2020-10-07T20:56:02.452049",
  148.      "status": "completed"
  149.     },
  150.     "tags": []
  151.    },
  152.    "outputs": [],
  153.    "source": [
  154.     "model = Sequential()\n",
  155.     "\n",
  156.     "model.add(Dense(128,activation  = 'relu',input_dim =13))\n",
  157.     "model.add(Dense(64,activation  = 'relu'))\n",
  158.     "model.add(Dense(32,activation  = 'relu'))\n",
  159.     "model.add(Dense(16,activation  = 'relu'))\n",
  160.     "model.add(Dense(1))\n",
  161.     "model.compile(optimizer = 'adam',loss = 'mean_squared_error')"
  162.    ]
  163.   },
  164.   {
  165.    "cell_type": "code",
  166.    "execution_count": 7,
  167.    "metadata": {
  168.     "execution": {
  169.      "iopub.execute_input": "2020-10-07T20:56:02.934653Z",
  170.      "iopub.status.busy": "2020-10-07T20:56:02.933663Z",
  171.      "iopub.status.idle": "2020-10-07T20:56:07.137189Z",
  172.      "shell.execute_reply": "2020-10-07T20:56:07.137910Z"
  173.     },
  174.     "papermill": {
  175.      "duration": 4.268213,
  176.      "end_time": "2020-10-07T20:56:07.138097",
  177.      "exception": false,
  178.      "start_time": "2020-10-07T20:56:02.869884",
  179.      "status": "completed"
  180.     },
  181.     "tags": []
  182.    },
  183.    "outputs": [
  184.     {
  185.      "name": "stdout",
  186.      "output_type": "stream",
  187.      "text": [
  188.       "Epoch 1/100\n",
  189.       "13/13 [==============================] - 2s 3ms/step - loss: 569.1288\n",
  190.       "Epoch 2/100\n",
  191.       "13/13 [==============================] - 0s 4ms/step - loss: 494.4398\n",
  192.       "Epoch 3/100\n",
  193.       "13/13 [==============================] - 0s 7ms/step - loss: 319.8408\n",
  194.       "Epoch 4/100\n",
  195.       "13/13 [==============================] - 0s 5ms/step - loss: 105.5404\n",
  196.       "Epoch 5/100\n",
  197.       "13/13 [==============================] - 0s 4ms/step - loss: 63.4671\n",
  198.       "Epoch 6/100\n",
  199.       "13/13 [==============================] - 0s 7ms/step - loss: 37.5063\n",
  200.       "Epoch 7/100\n",
  201.       "13/13 [==============================] - 0s 8ms/step - loss: 28.0821\n",
  202.       "Epoch 8/100\n",
  203.       "13/13 [==============================] - 0s 8ms/step - loss: 23.9037\n",
  204.       "Epoch 9/100\n",
  205.       "13/13 [==============================] - 0s 4ms/step - loss: 21.2490\n",
  206.       "Epoch 10/100\n",
  207.       "13/13 [==============================] - 0s 6ms/step - loss: 19.5451\n",
  208.       "Epoch 11/100\n",
  209.       "13/13 [==============================] - 0s 7ms/step - loss: 18.2643\n",
  210.       "Epoch 12/100\n",
  211.       "13/13 [==============================] - 0s 5ms/step - loss: 17.0230\n",
  212.       "Epoch 13/100\n",
  213.       "13/13 [==============================] - 0s 3ms/step - loss: 16.1230\n",
  214.       "Epoch 14/100\n",
  215.       "13/13 [==============================] - 0s 3ms/step - loss: 15.3916\n",
  216.       "Epoch 15/100\n",
  217.       "13/13 [==============================] - 0s 3ms/step - loss: 14.6173\n",
  218.       "Epoch 16/100\n",
  219.       "13/13 [==============================] - 0s 3ms/step - loss: 13.9202\n",
  220.       "Epoch 17/100\n",
  221.       "13/13 [==============================] - 0s 3ms/step - loss: 13.5544\n",
  222.       "Epoch 18/100\n",
  223.       "13/13 [==============================] - 0s 4ms/step - loss: 13.1145\n",
  224.       "Epoch 19/100\n",
  225.       "13/13 [==============================] - 0s 4ms/step - loss: 12.5996\n",
  226.       "Epoch 20/100\n",
  227.       "13/13 [==============================] - 0s 9ms/step - loss: 12.3431\n",
  228.       "Epoch 21/100\n",
  229.       "13/13 [==============================] - 0s 4ms/step - loss: 11.8682\n",
  230.       "Epoch 22/100\n",
  231.       "13/13 [==============================] - 0s 4ms/step - loss: 11.6428\n",
  232.       "Epoch 23/100\n",
  233.       "13/13 [==============================] - 0s 5ms/step - loss: 11.4789\n",
  234.       "Epoch 24/100\n",
  235.       "13/13 [==============================] - 0s 3ms/step - loss: 11.1080\n",
  236.       "Epoch 25/100\n",
  237.       "13/13 [==============================] - 0s 3ms/step - loss: 10.8256\n",
  238.       "Epoch 26/100\n",
  239.       "13/13 [==============================] - 0s 4ms/step - loss: 10.6871\n",
  240.       "Epoch 27/100\n",
  241.       "13/13 [==============================] - 0s 4ms/step - loss: 10.6583\n",
  242.       "Epoch 28/100\n",
  243.       "13/13 [==============================] - 0s 4ms/step - loss: 10.3711\n",
  244.       "Epoch 29/100\n",
  245.       "13/13 [==============================] - 0s 4ms/step - loss: 10.1583\n",
  246.       "Epoch 30/100\n",
  247.       "13/13 [==============================] - 0s 4ms/step - loss: 10.0381\n",
  248.       "Epoch 31/100\n",
  249.       "13/13 [==============================] - 0s 4ms/step - loss: 9.9237\n",
  250.       "Epoch 32/100\n",
  251.       "13/13 [==============================] - 0s 4ms/step - loss: 9.6011\n",
  252.       "Epoch 33/100\n",
  253.       "13/13 [==============================] - 0s 5ms/step - loss: 9.4041\n",
  254.       "Epoch 34/100\n",
  255.       "13/13 [==============================] - 0s 7ms/step - loss: 9.3129\n",
  256.       "Epoch 35/100\n",
  257.       "13/13 [==============================] - 0s 6ms/step - loss: 9.0364\n",
  258.       "Epoch 36/100\n",
  259.       "13/13 [==============================] - 0s 9ms/step - loss: 9.1486\n",
  260.       "Epoch 37/100\n",
  261.       "13/13 [==============================] - 0s 5ms/step - loss: 8.8286\n",
  262.       "Epoch 38/100\n",
  263.       "13/13 [==============================] - 0s 4ms/step - loss: 8.7360\n",
  264.       "Epoch 39/100\n",
  265.       "13/13 [==============================] - 0s 5ms/step - loss: 8.6275\n",
  266.       "Epoch 40/100\n",
  267.       "13/13 [==============================] - 0s 6ms/step - loss: 8.4064\n",
  268.       "Epoch 41/100\n",
  269.       "13/13 [==============================] - 0s 4ms/step - loss: 8.1975\n",
  270.       "Epoch 42/100\n",
  271.       "13/13 [==============================] - 0s 4ms/step - loss: 8.0858\n",
  272.       "Epoch 43/100\n",
  273.       "13/13 [==============================] - 0s 6ms/step - loss: 7.9936\n",
  274.       "Epoch 44/100\n",
  275.       "13/13 [==============================] - 0s 6ms/step - loss: 7.9371\n",
  276.       "Epoch 45/100\n",
  277.       "13/13 [==============================] - 0s 7ms/step - loss: 7.6954\n",
  278.       "Epoch 46/100\n",
  279.       "13/13 [==============================] - 0s 7ms/step - loss: 7.6290\n",
  280.       "Epoch 47/100\n",
  281.       "13/13 [==============================] - 0s 7ms/step - loss: 7.3993\n",
  282.       "Epoch 48/100\n",
  283.       "13/13 [==============================] - 0s 8ms/step - loss: 7.2998\n",
  284.       "Epoch 49/100\n",
  285.       "13/13 [==============================] - 0s 3ms/step - loss: 7.0291\n",
  286.       "Epoch 50/100\n",
  287.       "13/13 [==============================] - 0s 4ms/step - loss: 7.1075\n",
  288.       "Epoch 51/100\n",
  289.       "13/13 [==============================] - 0s 3ms/step - loss: 7.0854\n",
  290.       "Epoch 52/100\n",
  291.       "13/13 [==============================] - 0s 5ms/step - loss: 7.1318\n",
  292.       "Epoch 53/100\n",
  293.       "13/13 [==============================] - 0s 3ms/step - loss: 7.5909\n",
  294.       "Epoch 54/100\n",
  295.       "13/13 [==============================] - 0s 3ms/step - loss: 6.7638\n",
  296.       "Epoch 55/100\n",
  297.       "13/13 [==============================] - 0s 3ms/step - loss: 6.4285\n",
  298.       "Epoch 56/100\n",
  299.       "13/13 [==============================] - 0s 5ms/step - loss: 6.2816\n",
  300.       "Epoch 57/100\n",
  301.       "13/13 [==============================] - 0s 10ms/step - loss: 6.2752\n",
  302.       "Epoch 58/100\n",
  303.       "13/13 [==============================] - 0s 3ms/step - loss: 6.1827\n",
  304.       "Epoch 59/100\n",
  305.       "13/13 [==============================] - 0s 3ms/step - loss: 6.3984\n",
  306.       "Epoch 60/100\n",
  307.       "13/13 [==============================] - 0s 5ms/step - loss: 6.1120\n",
  308.       "Epoch 61/100\n",
  309.       "13/13 [==============================] - 0s 4ms/step - loss: 5.8841\n",
  310.       "Epoch 62/100\n",
  311.       "13/13 [==============================] - 0s 7ms/step - loss: 5.7373\n",
  312.       "Epoch 63/100\n",
  313.       "13/13 [==============================] - 0s 6ms/step - loss: 5.7480\n",
  314.       "Epoch 64/100\n",
  315.       "13/13 [==============================] - 0s 5ms/step - loss: 5.5833\n",
  316.       "Epoch 65/100\n",
  317.       "13/13 [==============================] - 0s 4ms/step - loss: 5.4510\n",
  318.       "Epoch 66/100\n",
  319.       "13/13 [==============================] - 0s 6ms/step - loss: 5.5317\n",
  320.       "Epoch 67/100\n",
  321.       "13/13 [==============================] - 0s 5ms/step - loss: 5.2579\n",
  322.       "Epoch 68/100\n",
  323.       "13/13 [==============================] - 0s 2ms/step - loss: 5.3661\n",
  324.       "Epoch 69/100\n",
  325.       "13/13 [==============================] - 0s 2ms/step - loss: 5.1459\n",
  326.       "Epoch 70/100\n",
  327.       "13/13 [==============================] - 0s 3ms/step - loss: 5.3962\n",
  328.       "Epoch 71/100\n",
  329.       "13/13 [==============================] - 0s 5ms/step - loss: 4.9652\n",
  330.       "Epoch 72/100\n",
  331.       "13/13 [==============================] - 0s 4ms/step - loss: 4.8648\n",
  332.       "Epoch 73/100\n",
  333.       "13/13 [==============================] - 0s 5ms/step - loss: 4.9541\n",
  334.       "Epoch 74/100\n",
  335.       "13/13 [==============================] - 0s 4ms/step - loss: 4.6797\n",
  336.       "Epoch 75/100\n",
  337.       "13/13 [==============================] - 0s 4ms/step - loss: 4.6717\n",
  338.       "Epoch 76/100\n",
  339.       "13/13 [==============================] - 0s 2ms/step - loss: 4.5783\n",
  340.       "Epoch 77/100\n",
  341.       "13/13 [==============================] - 0s 4ms/step - loss: 4.5508\n",
  342.       "Epoch 78/100\n",
  343.       "13/13 [==============================] - 0s 2ms/step - loss: 4.5492\n",
  344.       "Epoch 79/100\n",
  345.       "13/13 [==============================] - 0s 5ms/step - loss: 4.5550\n",
  346.       "Epoch 80/100\n",
  347.       "13/13 [==============================] - 0s 5ms/step - loss: 4.4583\n",
  348.       "Epoch 81/100\n",
  349.       "13/13 [==============================] - 0s 4ms/step - loss: 4.6703\n",
  350.       "Epoch 82/100\n",
  351.       "13/13 [==============================] - 0s 6ms/step - loss: 4.9047\n",
  352.       "Epoch 83/100\n",
  353.       "13/13 [==============================] - 0s 8ms/step - loss: 4.1940\n",
  354.       "Epoch 84/100\n",
  355.       "13/13 [==============================] - 0s 6ms/step - loss: 4.1827\n",
  356.       "Epoch 85/100\n",
  357.       "13/13 [==============================] - 0s 5ms/step - loss: 4.1972\n",
  358.       "Epoch 86/100\n",
  359.       "13/13 [==============================] - 0s 3ms/step - loss: 4.1678\n",
  360.       "Epoch 87/100\n",
  361.       "13/13 [==============================] - 0s 11ms/step - loss: 4.0276\n",
  362.       "Epoch 88/100\n",
  363.       "13/13 [==============================] - 0s 12ms/step - loss: 4.2794\n",
  364.       "Epoch 89/100\n",
  365.       "13/13 [==============================] - 0s 6ms/step - loss: 4.1283\n",
  366.       "Epoch 90/100\n",
  367.       "13/13 [==============================] - 0s 7ms/step - loss: 4.5400\n",
  368.       "Epoch 91/100\n",
  369.       "13/13 [==============================] - 0s 7ms/step - loss: 4.0902\n",
  370.       "Epoch 92/100\n",
  371.       "13/13 [==============================] - 0s 7ms/step - loss: 4.1553\n",
  372.       "Epoch 93/100\n",
  373.       "13/13 [==============================] - 0s 5ms/step - loss: 4.2422\n",
  374.       "Epoch 94/100\n",
  375.       "13/13 [==============================] - 0s 3ms/step - loss: 3.8847\n",
  376.       "Epoch 95/100\n",
  377.       "13/13 [==============================] - 0s 4ms/step - loss: 3.8599\n",
  378.       "Epoch 96/100\n",
  379.       "13/13 [==============================] - 0s 8ms/step - loss: 3.7208\n",
  380.       "Epoch 97/100\n",
  381.       "13/13 [==============================] - 0s 4ms/step - loss: 3.8535\n",
  382.       "Epoch 98/100\n",
  383.       "13/13 [==============================] - 0s 5ms/step - loss: 3.6761\n",
  384.       "Epoch 99/100\n",
  385.       "13/13 [==============================] - 0s 3ms/step - loss: 3.4122\n",
  386.       "Epoch 100/100\n",
  387.       "13/13 [==============================] - 0s 6ms/step - loss: 3.5394\n"
  388.      ]
  389.     },
  390.     {
  391.      "data": {
  392.       "text/plain": [
  393.        "<keras.callbacks.History at 0x240929ddb80>"
  394.       ]
  395.      },
  396.      "execution_count": 7,
  397.      "metadata": {},
  398.      "output_type": "execute_result"
  399.     }
  400.    ],
  401.    "source": [
  402.     "model.fit(X_train, y_train, epochs = 100)"
  403.    ]
  404.   },
  405.   {
  406.    "cell_type": "markdown",
  407.    "metadata": {
  408.     "papermill": {
  409.      "duration": 0.144695,
  410.      "end_time": "2020-10-07T20:56:07.429767",
  411.      "exception": false,
  412.      "start_time": "2020-10-07T20:56:07.285072",
  413.      "status": "completed"
  414.     },
  415.     "tags": []
  416.    },
  417.    "source": [
  418.     "<a id = 'eval'></a>\n",
  419.     "### Evaluation of the model"
  420.    ]
  421.   },
  422.   {
  423.    "cell_type": "code",
  424.    "execution_count": 8,
  425.    "metadata": {
  426.     "execution": {
  427.      "iopub.execute_input": "2020-10-07T20:56:07.725859Z",
  428.      "iopub.status.busy": "2020-10-07T20:56:07.724391Z",
  429.      "iopub.status.idle": "2020-10-07T20:56:07.944661Z",
  430.      "shell.execute_reply": "2020-10-07T20:56:07.945236Z"
  431.     },
  432.     "papermill": {
  433.      "duration": 0.370667,
  434.      "end_time": "2020-10-07T20:56:07.945463",
  435.      "exception": false,
  436.      "start_time": "2020-10-07T20:56:07.574796",
  437.      "status": "completed"
  438.     },
  439.     "tags": []
  440.    },
  441.    "outputs": [
  442.     {
  443.      "name": "stdout",
  444.      "output_type": "stream",
  445.      "text": [
  446.       "4/4 [==============================] - 0s 3ms/step\n"
  447.      ]
  448.     }
  449.    ],
  450.    "source": [
  451.     "y_pred = model.predict(X_test)"
  452.    ]
  453.   },
  454.   {
  455.    "cell_type": "code",
  456.    "execution_count": 9,
  457.    "metadata": {
  458.     "execution": {
  459.      "iopub.execute_input": "2020-10-07T20:56:08.252035Z",
  460.      "iopub.status.busy": "2020-10-07T20:56:08.251041Z",
  461.      "iopub.status.idle": "2020-10-07T20:56:08.255851Z",
  462.      "shell.execute_reply": "2020-10-07T20:56:08.255145Z"
  463.     },
  464.     "papermill": {
  465.      "duration": 0.159132,
  466.      "end_time": "2020-10-07T20:56:08.255991",
  467.      "exception": false,
  468.      "start_time": "2020-10-07T20:56:08.096859",
  469.      "status": "completed"
  470.     },
  471.     "tags": []
  472.    },
  473.    "outputs": [
  474.     {
  475.      "name": "stdout",
  476.      "output_type": "stream",
  477.      "text": [
  478.       "0.856404959522691\n"
  479.      ]
  480.     }
  481.    ],
  482.    "source": [
  483.     "from sklearn.metrics import r2_score\n",
  484.     "r2 = r2_score(y_test, y_pred)\n",
  485.     "print(r2)"
  486.    ]
  487.   },
  488.   {
  489.    "cell_type": "code",
  490.    "execution_count": 10,
  491.    "metadata": {
  492.     "execution": {
  493.      "iopub.execute_input": "2020-10-07T20:56:08.557357Z",
  494.      "iopub.status.busy": "2020-10-07T20:56:08.556409Z",
  495.      "iopub.status.idle": "2020-10-07T20:56:08.560011Z",
  496.      "shell.execute_reply": "2020-10-07T20:56:08.560689Z"
  497.     },
  498.     "papermill": {
  499.      "duration": 0.156747,
  500.      "end_time": "2020-10-07T20:56:08.560855",
  501.      "exception": false,
  502.      "start_time": "2020-10-07T20:56:08.404108",
  503.      "status": "completed"
  504.     },
  505.     "tags": []
  506.    },
  507.    "outputs": [
  508.     {
  509.      "name": "stdout",
  510.      "output_type": "stream",
  511.      "text": [
  512.       "3.1975390155396077\n"
  513.      ]
  514.     }
  515.    ],
  516.    "source": [
  517.     "# Predicting RMSE the Test set results\n",
  518.     "from sklearn.metrics import mean_squared_error\n",
  519.     "rmse = (np.sqrt(mean_squared_error(y_test, y_pred)))\n",
  520.     "print(rmse)"
  521.    ]
  522.   },
  523.   {
  524.    "cell_type": "markdown",
  525.    "metadata": {
  526.     "papermill": {
  527.      "duration": 0.145421,
  528.      "end_time": "2020-10-07T20:56:08.851425",
  529.      "exception": false,
  530.      "start_time": "2020-10-07T20:56:08.706004",
  531.      "status": "completed"
  532.     },
  533.     "tags": []
  534.    },
  535.    "source": [
  536.     "<a id = 'conclude'></a>\n",
  537.     "## Conclusion\n",
  538.     "\n",
  539.     "Using a simple neural network, we were able to improve the model significantly. I encourage you to try alterating the hyperparameters of the model and see if you can get better model"
  540.    ]
  541.   }
  542.  ],
  543.  "metadata": {
  544.   "kernelspec": {
  545.    "display_name": "Python 3",
  546.    "language": "python",
  547.    "name": "python3"
  548.   },
  549.   "language_info": {
  550.    "codemirror_mode": {
  551.     "name": "ipython",
  552.     "version": 3
  553.    },
  554.    "file_extension": ".py",
  555.    "mimetype": "text/x-python",
  556.    "name": "python",
  557.    "nbconvert_exporter": "python",
  558.    "pygments_lexer": "ipython3",
  559.    "version": "3.9.12"
  560.   },
  561.   "papermill": {
  562.    "duration": 28.602522,
  563.    "end_time": "2020-10-07T20:56:09.403032",
  564.    "environment_variables": {},
  565.    "exception": null,
  566.    "input_path": "__notebook__.ipynb",
  567.    "output_path": "__notebook__.ipynb",
  568.    "parameters": {},
  569.    "start_time": "2020-10-07T20:55:40.800510",
  570.    "version": "2.1.0"
  571.   }
  572.  },
  573.  "nbformat": 4,
  574.  "nbformat_minor": 4
  575. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement