Created
June 15, 2020 03:38
-
-
Save SoyabulIslamLincoln/42dc261ed4b0d92186ee240ce8f76b38 to your computer and use it in GitHub Desktop.
Created on Skills Network Labs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 11, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "\n", | |
| "import pandas as pd\n", | |
| "import numpy as np\n", | |
| "import matplotlib.pyplot as plt\n", | |
| "%matplotlib inline\n", | |
| "import os\n", | |
| "\n", | |
| "from sklearn.model_selection import train_test_split\n", | |
| "\n", | |
| "\n", | |
| "import sklearn.model_selection as model_selection" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 2, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/html": [ | |
| "<div>\n", | |
| "<style scoped>\n", | |
| " .dataframe tbody tr th:only-of-type {\n", | |
| " vertical-align: middle;\n", | |
| " }\n", | |
| "\n", | |
| " .dataframe tbody tr th {\n", | |
| " vertical-align: top;\n", | |
| " }\n", | |
| "\n", | |
| " .dataframe thead th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>Cement</th>\n", | |
| " <th>Blast Furnace Slag</th>\n", | |
| " <th>Fly Ash</th>\n", | |
| " <th>Water</th>\n", | |
| " <th>Superplasticizer</th>\n", | |
| " <th>Coarse Aggregate</th>\n", | |
| " <th>Fine Aggregate</th>\n", | |
| " <th>Age</th>\n", | |
| " <th>Strength</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>0</th>\n", | |
| " <td>540.0</td>\n", | |
| " <td>0.0</td>\n", | |
| " <td>0.0</td>\n", | |
| " <td>162.0</td>\n", | |
| " <td>2.5</td>\n", | |
| " <td>1040.0</td>\n", | |
| " <td>676.0</td>\n", | |
| " <td>28</td>\n", | |
| " <td>79.99</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>1</th>\n", | |
| " <td>540.0</td>\n", | |
| " <td>0.0</td>\n", | |
| " <td>0.0</td>\n", | |
| " <td>162.0</td>\n", | |
| " <td>2.5</td>\n", | |
| " <td>1055.0</td>\n", | |
| " <td>676.0</td>\n", | |
| " <td>28</td>\n", | |
| " <td>61.89</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>2</th>\n", | |
| " <td>332.5</td>\n", | |
| " <td>142.5</td>\n", | |
| " <td>0.0</td>\n", | |
| " <td>228.0</td>\n", | |
| " <td>0.0</td>\n", | |
| " <td>932.0</td>\n", | |
| " <td>594.0</td>\n", | |
| " <td>270</td>\n", | |
| " <td>40.27</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>3</th>\n", | |
| " <td>332.5</td>\n", | |
| " <td>142.5</td>\n", | |
| " <td>0.0</td>\n", | |
| " <td>228.0</td>\n", | |
| " <td>0.0</td>\n", | |
| " <td>932.0</td>\n", | |
| " <td>594.0</td>\n", | |
| " <td>365</td>\n", | |
| " <td>41.05</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>4</th>\n", | |
| " <td>198.6</td>\n", | |
| " <td>132.4</td>\n", | |
| " <td>0.0</td>\n", | |
| " <td>192.0</td>\n", | |
| " <td>0.0</td>\n", | |
| " <td>978.4</td>\n", | |
| " <td>825.5</td>\n", | |
| " <td>360</td>\n", | |
| " <td>44.30</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " Cement Blast Furnace Slag Fly Ash Water Superplasticizer \\\n", | |
| "0 540.0 0.0 0.0 162.0 2.5 \n", | |
| "1 540.0 0.0 0.0 162.0 2.5 \n", | |
| "2 332.5 142.5 0.0 228.0 0.0 \n", | |
| "3 332.5 142.5 0.0 228.0 0.0 \n", | |
| "4 198.6 132.4 0.0 192.0 0.0 \n", | |
| "\n", | |
| " Coarse Aggregate Fine Aggregate Age Strength \n", | |
| "0 1040.0 676.0 28 79.99 \n", | |
| "1 1055.0 676.0 28 61.89 \n", | |
| "2 932.0 594.0 270 40.27 \n", | |
| "3 932.0 594.0 365 41.05 \n", | |
| "4 978.4 825.5 360 44.30 " | |
| ] | |
| }, | |
| "execution_count": 2, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "data=pd.read_csv(\"concrete_data.csv\")\n", | |
| "data.head()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 3, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "<class 'pandas.core.frame.DataFrame'>\n", | |
| "RangeIndex: 1030 entries, 0 to 1029\n", | |
| "Data columns (total 9 columns):\n", | |
| " # Column Non-Null Count Dtype \n", | |
| "--- ------ -------------- ----- \n", | |
| " 0 Cement 1030 non-null float64\n", | |
| " 1 Blast Furnace Slag 1030 non-null float64\n", | |
| " 2 Fly Ash 1030 non-null float64\n", | |
| " 3 Water 1030 non-null float64\n", | |
| " 4 Superplasticizer 1030 non-null float64\n", | |
| " 5 Coarse Aggregate 1030 non-null float64\n", | |
| " 6 Fine Aggregate 1030 non-null float64\n", | |
| " 7 Age 1030 non-null int64 \n", | |
| " 8 Strength 1030 non-null float64\n", | |
| "dtypes: float64(8), int64(1)\n", | |
| "memory usage: 72.5 KB\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "data.info()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 8, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "Index(['Cement', 'Blast Furnace Slag', 'Fly Ash', 'Water', 'Superplasticizer',\n", | |
| " 'Coarse Aggregate', 'Fine Aggregate', 'Age', 'Strength'],\n", | |
| " dtype='object')\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "data_columns = data.columns\n", | |
| "print(data_columns)\n" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 9, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| " Cement Blast Furnace Slag Fly Ash Water Superplasticizer \\\n", | |
| "0 540.0 0.0 0.0 162.0 2.5 \n", | |
| "1 540.0 0.0 0.0 162.0 2.5 \n", | |
| "2 332.5 142.5 0.0 228.0 0.0 \n", | |
| "3 332.5 142.5 0.0 228.0 0.0 \n", | |
| "4 198.6 132.4 0.0 192.0 0.0 \n", | |
| "... ... ... ... ... ... \n", | |
| "1025 276.4 116.0 90.3 179.6 8.9 \n", | |
| "1026 322.2 0.0 115.6 196.0 10.4 \n", | |
| "1027 148.5 139.4 108.6 192.7 6.1 \n", | |
| "1028 159.1 186.7 0.0 175.6 11.3 \n", | |
| "1029 260.9 100.5 78.3 200.6 8.6 \n", | |
| "\n", | |
| " Coarse Aggregate Fine Aggregate Age \n", | |
| "0 1040.0 676.0 28 \n", | |
| "1 1055.0 676.0 28 \n", | |
| "2 932.0 594.0 270 \n", | |
| "3 932.0 594.0 365 \n", | |
| "4 978.4 825.5 360 \n", | |
| "... ... ... ... \n", | |
| "1025 870.1 768.3 28 \n", | |
| "1026 817.9 813.4 28 \n", | |
| "1027 892.4 780.0 28 \n", | |
| "1028 989.6 788.9 28 \n", | |
| "1029 864.5 761.5 28 \n", | |
| "\n", | |
| "[1030 rows x 8 columns]\n", | |
| "0 79.99\n", | |
| "1 61.89\n", | |
| "2 40.27\n", | |
| "3 41.05\n", | |
| "4 44.30\n", | |
| " ... \n", | |
| "1025 44.28\n", | |
| "1026 31.18\n", | |
| "1027 23.70\n", | |
| "1028 32.77\n", | |
| "1029 32.40\n", | |
| "Name: Strength, Length: 1030, dtype: float64\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "X = data[data_columns[data_columns != 'Strength']] # all columns except Strength\n", | |
| "y = data['Strength'] # Strength column\n", | |
| "print(X)\n", | |
| "print(y)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 13, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "X_train: Cement Blast Furnace Slag Fly Ash Water Superplasticizer \\\n", | |
| "582 170.3 155.5 0.0 185.7 0.0 \n", | |
| "636 300.0 0.0 0.0 184.0 0.0 \n", | |
| "341 297.2 0.0 117.5 174.8 9.5 \n", | |
| "407 165.0 128.5 132.1 175.1 8.1 \n", | |
| "949 148.1 0.0 136.6 158.1 16.1 \n", | |
| ".. ... ... ... ... ... \n", | |
| "910 144.0 136.0 106.0 178.0 7.0 \n", | |
| "754 540.0 0.0 0.0 173.0 0.0 \n", | |
| "823 322.0 0.0 0.0 203.0 0.0 \n", | |
| "950 326.5 0.0 137.9 199.0 10.8 \n", | |
| "502 491.0 26.0 123.0 210.0 3.9 \n", | |
| "\n", | |
| " Coarse Aggregate Fine Aggregate Age \n", | |
| "582 1026.6 724.3 28 \n", | |
| "636 1075.0 795.0 28 \n", | |
| "341 1022.8 753.5 28 \n", | |
| "407 1005.8 746.6 3 \n", | |
| "949 1001.8 830.1 28 \n", | |
| ".. ... ... ... \n", | |
| "910 941.0 774.0 28 \n", | |
| "754 1125.0 613.0 90 \n", | |
| "823 974.0 800.0 180 \n", | |
| "950 801.1 792.5 28 \n", | |
| "502 882.0 699.0 7 \n", | |
| "\n", | |
| "[721 rows x 8 columns]\n", | |
| "y_train: 582 25.73\n", | |
| "636 26.85\n", | |
| "341 47.40\n", | |
| "407 19.42\n", | |
| "949 17.96\n", | |
| " ... \n", | |
| "910 26.14\n", | |
| "754 69.66\n", | |
| "823 29.59\n", | |
| "950 38.63\n", | |
| "502 33.49\n", | |
| "Name: Strength, Length: 721, dtype: float64\n", | |
| "X_test: Cement Blast Furnace Slag Fly Ash Water Superplasticizer \\\n", | |
| "899 145.0 0.0 134.0 181.0 11.0 \n", | |
| "39 237.5 237.5 0.0 228.0 0.0 \n", | |
| "726 331.0 0.0 0.0 192.0 0.0 \n", | |
| "36 237.5 237.5 0.0 228.0 0.0 \n", | |
| "11 198.6 132.4 0.0 192.0 0.0 \n", | |
| "... ... ... ... ... ... \n", | |
| "513 424.0 22.0 132.0 168.0 8.9 \n", | |
| "379 500.0 0.0 0.0 140.0 4.0 \n", | |
| "1020 288.4 121.0 0.0 177.4 7.0 \n", | |
| "92 337.9 189.0 0.0 174.9 9.5 \n", | |
| "674 236.0 157.0 0.0 192.0 0.0 \n", | |
| "\n", | |
| " Coarse Aggregate Fine Aggregate Age \n", | |
| "899 979.0 812.0 28 \n", | |
| "39 932.0 594.0 180 \n", | |
| "726 1025.0 821.0 3 \n", | |
| "36 932.0 594.0 28 \n", | |
| "11 978.4 825.5 28 \n", | |
| "... ... ... ... \n", | |
| "513 822.0 750.0 7 \n", | |
| "379 966.0 853.0 28 \n", | |
| "1020 907.9 829.5 28 \n", | |
| "92 944.7 755.8 3 \n", | |
| "674 972.6 749.1 3 \n", | |
| "\n", | |
| "[309 rows x 8 columns]\n", | |
| "y_test: 899 13.20\n", | |
| "39 36.25\n", | |
| "726 14.31\n", | |
| "36 30.08\n", | |
| "11 28.02\n", | |
| " ... \n", | |
| "513 40.29\n", | |
| "379 67.57\n", | |
| "1020 42.14\n", | |
| "92 24.10\n", | |
| "674 13.57\n", | |
| "Name: Strength, Length: 309, dtype: float64\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, train_size=0.70,test_size=0.30)\n", | |
| "print (\"X_train: \", X_train)\n", | |
| "print (\"y_train: \", y_train)\n", | |
| "print(\"X_test: \", X_test)\n", | |
| "print (\"y_test: \", y_test)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 14, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stderr", | |
| "output_type": "stream", | |
| "text": [ | |
| "Using TensorFlow backend.\n", | |
| "/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n", | |
| " _np_qint8 = np.dtype([(\"qint8\", np.int8, 1)])\n", | |
| "/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n", | |
| " _np_quint8 = np.dtype([(\"quint8\", np.uint8, 1)])\n", | |
| "/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:521: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n", | |
| " _np_qint16 = np.dtype([(\"qint16\", np.int16, 1)])\n", | |
| "/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:522: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n", | |
| " _np_quint16 = np.dtype([(\"quint16\", np.uint16, 1)])\n", | |
| "/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n", | |
| " _np_qint32 = np.dtype([(\"qint32\", np.int32, 1)])\n", | |
| "/home/jupyterlab/conda/envs/python/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n", | |
| " np_resource = np.dtype([(\"resource\", np.ubyte, 1)])\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "import keras\n", | |
| "from keras.models import Sequential\n", | |
| "from keras.layers import Dense" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 16, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/html": [ | |
| "<div>\n", | |
| "<style scoped>\n", | |
| " .dataframe tbody tr th:only-of-type {\n", | |
| " vertical-align: middle;\n", | |
| " }\n", | |
| "\n", | |
| " .dataframe tbody tr th {\n", | |
| " vertical-align: top;\n", | |
| " }\n", | |
| "\n", | |
| " .dataframe thead th {\n", | |
| " text-align: right;\n", | |
| " }\n", | |
| "</style>\n", | |
| "<table border=\"1\" class=\"dataframe\">\n", | |
| " <thead>\n", | |
| " <tr style=\"text-align: right;\">\n", | |
| " <th></th>\n", | |
| " <th>Cement</th>\n", | |
| " <th>Blast Furnace Slag</th>\n", | |
| " <th>Fly Ash</th>\n", | |
| " <th>Water</th>\n", | |
| " <th>Superplasticizer</th>\n", | |
| " <th>Coarse Aggregate</th>\n", | |
| " <th>Fine Aggregate</th>\n", | |
| " <th>Age</th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " <tr>\n", | |
| " <th>0</th>\n", | |
| " <td>2.476712</td>\n", | |
| " <td>-0.856472</td>\n", | |
| " <td>-0.846733</td>\n", | |
| " <td>-0.916319</td>\n", | |
| " <td>-0.620147</td>\n", | |
| " <td>0.862735</td>\n", | |
| " <td>-1.217079</td>\n", | |
| " <td>-0.279597</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>1</th>\n", | |
| " <td>2.476712</td>\n", | |
| " <td>-0.856472</td>\n", | |
| " <td>-0.846733</td>\n", | |
| " <td>-0.916319</td>\n", | |
| " <td>-0.620147</td>\n", | |
| " <td>1.055651</td>\n", | |
| " <td>-1.217079</td>\n", | |
| " <td>-0.279597</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>2</th>\n", | |
| " <td>0.491187</td>\n", | |
| " <td>0.795140</td>\n", | |
| " <td>-0.846733</td>\n", | |
| " <td>2.174405</td>\n", | |
| " <td>-1.038638</td>\n", | |
| " <td>-0.526262</td>\n", | |
| " <td>-2.239829</td>\n", | |
| " <td>3.551340</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>3</th>\n", | |
| " <td>0.491187</td>\n", | |
| " <td>0.795140</td>\n", | |
| " <td>-0.846733</td>\n", | |
| " <td>2.174405</td>\n", | |
| " <td>-1.038638</td>\n", | |
| " <td>-0.526262</td>\n", | |
| " <td>-2.239829</td>\n", | |
| " <td>5.055221</td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th>4</th>\n", | |
| " <td>-0.790075</td>\n", | |
| " <td>0.678079</td>\n", | |
| " <td>-0.846733</td>\n", | |
| " <td>0.488555</td>\n", | |
| " <td>-1.038638</td>\n", | |
| " <td>0.070492</td>\n", | |
| " <td>0.647569</td>\n", | |
| " <td>4.976069</td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| "</table>\n", | |
| "</div>" | |
| ], | |
| "text/plain": [ | |
| " Cement Blast Furnace Slag Fly Ash Water Superplasticizer \\\n", | |
| "0 2.476712 -0.856472 -0.846733 -0.916319 -0.620147 \n", | |
| "1 2.476712 -0.856472 -0.846733 -0.916319 -0.620147 \n", | |
| "2 0.491187 0.795140 -0.846733 2.174405 -1.038638 \n", | |
| "3 0.491187 0.795140 -0.846733 2.174405 -1.038638 \n", | |
| "4 -0.790075 0.678079 -0.846733 0.488555 -1.038638 \n", | |
| "\n", | |
| " Coarse Aggregate Fine Aggregate Age \n", | |
| "0 0.862735 -1.217079 -0.279597 \n", | |
| "1 1.055651 -1.217079 -0.279597 \n", | |
| "2 -0.526262 -2.239829 3.551340 \n", | |
| "3 -0.526262 -2.239829 5.055221 \n", | |
| "4 0.070492 0.647569 4.976069 " | |
| ] | |
| }, | |
| "execution_count": 16, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "X_norm = (X - X.mean()) / X.std()\n", | |
| "X_norm.head()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 46, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "def regression_model():\n", | |
| " # create model\n", | |
| " model = Sequential()\n", | |
| " model.add(Dense(10, activation='relu', input_shape=(X_norm.shape[1],)))\n", | |
| " \n", | |
| " model.add(Dense(1))\n", | |
| " \n", | |
| " # compile model\n", | |
| " model.compile(optimizer='adam', loss='mean_squared_error')\n", | |
| " return model" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 47, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "<bound method Container.summary of <keras.models.Sequential object at 0x7f7c501b7898>>" | |
| ] | |
| }, | |
| "execution_count": 47, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "model=regression_model()\n", | |
| "model.summary" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 48, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "Epoch 1/100\n", | |
| "1030/1030 [==============================] - 1s 852us/step - loss: 1499.2279\n", | |
| "Epoch 2/100\n", | |
| "1030/1030 [==============================] - 0s 292us/step - loss: 1474.7804\n", | |
| "Epoch 3/100\n", | |
| "1030/1030 [==============================] - 0s 332us/step - loss: 1447.8195\n", | |
| "Epoch 4/100\n", | |
| "1030/1030 [==============================] - 0s 312us/step - loss: 1417.0028\n", | |
| "Epoch 5/100\n", | |
| "1030/1030 [==============================] - 0s 329us/step - loss: 1382.4389\n", | |
| "Epoch 6/100\n", | |
| "1030/1030 [==============================] - 0s 290us/step - loss: 1344.7577\n", | |
| "Epoch 7/100\n", | |
| "1030/1030 [==============================] - 0s 330us/step - loss: 1303.5137\n", | |
| "Epoch 8/100\n", | |
| "1030/1030 [==============================] - 0s 312us/step - loss: 1259.2532\n", | |
| "Epoch 9/100\n", | |
| "1030/1030 [==============================] - 0s 291us/step - loss: 1211.9896\n", | |
| "Epoch 10/100\n", | |
| "1030/1030 [==============================] - 0s 291us/step - loss: 1162.1605\n", | |
| "Epoch 11/100\n", | |
| "1030/1030 [==============================] - 0s 328us/step - loss: 1110.3673\n", | |
| "Epoch 12/100\n", | |
| "1030/1030 [==============================] - 0s 289us/step - loss: 1057.12170s - loss: 1030.\n", | |
| "Epoch 13/100\n", | |
| "1030/1030 [==============================] - 0s 271us/step - loss: 1003.5072\n", | |
| "Epoch 14/100\n", | |
| "1030/1030 [==============================] - 0s 308us/step - loss: 948.0073\n", | |
| "Epoch 15/100\n", | |
| "1030/1030 [==============================] - 0s 288us/step - loss: 893.3633 0s - loss: 950.968 - ETA: 0s - loss: 957.9\n", | |
| "Epoch 16/100\n", | |
| "1030/1030 [==============================] - 0s 330us/step - loss: 838.8630\n", | |
| "Epoch 17/100\n", | |
| "1030/1030 [==============================] - 0s 383us/step - loss: 785.0373\n", | |
| "Epoch 18/100\n", | |
| "1030/1030 [==============================] - 0s 290us/step - loss: 731.9281\n", | |
| "Epoch 19/100\n", | |
| "1030/1030 [==============================] - 0s 315us/step - loss: 680.7019\n", | |
| "Epoch 20/100\n", | |
| "1030/1030 [==============================] - 0s 285us/step - loss: 632.4166\n", | |
| "Epoch 21/100\n", | |
| "1030/1030 [==============================] - 0s 293us/step - loss: 586.6895\n", | |
| "Epoch 22/100\n", | |
| "1030/1030 [==============================] - 0s 288us/step - loss: 543.6928\n", | |
| "Epoch 23/100\n", | |
| "1030/1030 [==============================] - 0s 368us/step - loss: 504.3013\n", | |
| "Epoch 24/100\n", | |
| "1030/1030 [==============================] - 1s 504us/step - loss: 467.0234\n", | |
| "Epoch 25/100\n", | |
| "1030/1030 [==============================] - 0s 483us/step - loss: 433.4414\n", | |
| "Epoch 26/100\n", | |
| "1030/1030 [==============================] - 0s 372us/step - loss: 403.2962\n", | |
| "Epoch 27/100\n", | |
| "1030/1030 [==============================] - 1s 544us/step - loss: 375.8086\n", | |
| "Epoch 28/100\n", | |
| "1030/1030 [==============================] - 0s 290us/step - loss: 351.3655\n", | |
| "Epoch 29/100\n", | |
| "1030/1030 [==============================] - 0s 373us/step - loss: 330.0289\n", | |
| "Epoch 30/100\n", | |
| "1030/1030 [==============================] - 0s 286us/step - loss: 311.6830\n", | |
| "Epoch 31/100\n", | |
| "1030/1030 [==============================] - 0s 275us/step - loss: 295.6040\n", | |
| "Epoch 32/100\n", | |
| "1030/1030 [==============================] - 0s 331us/step - loss: 281.7607\n", | |
| "Epoch 33/100\n", | |
| "1030/1030 [==============================] - 0s 429us/step - loss: 269.8947\n", | |
| "Epoch 34/100\n", | |
| "1030/1030 [==============================] - 0s 287us/step - loss: 259.4740\n", | |
| "Epoch 35/100\n", | |
| "1030/1030 [==============================] - 0s 289us/step - loss: 250.7062\n", | |
| "Epoch 36/100\n", | |
| "1030/1030 [==============================] - 0s 274us/step - loss: 243.1234\n", | |
| "Epoch 37/100\n", | |
| "1030/1030 [==============================] - 0s 288us/step - loss: 236.1347\n", | |
| "Epoch 38/100\n", | |
| "1030/1030 [==============================] - 0s 250us/step - loss: 230.2213 0s - loss: 227.2\n", | |
| "Epoch 39/100\n", | |
| "1030/1030 [==============================] - 0s 237us/step - loss: 225.0481\n", | |
| "Epoch 40/100\n", | |
| "1030/1030 [==============================] - 0s 293us/step - loss: 220.2756\n", | |
| "Epoch 41/100\n", | |
| "1030/1030 [==============================] - 0s 329us/step - loss: 216.1693\n", | |
| "Epoch 42/100\n", | |
| "1030/1030 [==============================] - 1s 1ms/step - loss: 211.9916\n", | |
| "Epoch 43/100\n", | |
| "1030/1030 [==============================] - 0s 326us/step - loss: 208.4086\n", | |
| "Epoch 44/100\n", | |
| "1030/1030 [==============================] - 0s 272us/step - loss: 205.3200\n", | |
| "Epoch 45/100\n", | |
| "1030/1030 [==============================] - 0s 347us/step - loss: 202.3922\n", | |
| "Epoch 46/100\n", | |
| "1030/1030 [==============================] - 0s 290us/step - loss: 199.6187\n", | |
| "Epoch 47/100\n", | |
| "1030/1030 [==============================] - 0s 293us/step - loss: 196.8854\n", | |
| "Epoch 48/100\n", | |
| "1030/1030 [==============================] - 1s 563us/step - loss: 194.5293\n", | |
| "Epoch 49/100\n", | |
| "1030/1030 [==============================] - 1s 600us/step - loss: 192.2680\n", | |
| "Epoch 50/100\n", | |
| "1030/1030 [==============================] - 1s 504us/step - loss: 189.7911\n", | |
| "Epoch 51/100\n", | |
| "1030/1030 [==============================] - 0s 471us/step - loss: 187.6586\n", | |
| "Epoch 52/100\n", | |
| "1030/1030 [==============================] - 1s 505us/step - loss: 185.4883\n", | |
| "Epoch 53/100\n", | |
| "1030/1030 [==============================] - 1s 583us/step - loss: 183.6763\n", | |
| "Epoch 54/100\n", | |
| "1030/1030 [==============================] - 0s 351us/step - loss: 181.3918\n", | |
| "Epoch 55/100\n", | |
| "1030/1030 [==============================] - ETA: 0s - loss: 179.862 - 0s 311us/step - loss: 179.4997\n", | |
| "Epoch 56/100\n", | |
| "1030/1030 [==============================] - 0s 369us/step - loss: 177.7032\n", | |
| "Epoch 57/100\n", | |
| "1030/1030 [==============================] - 0s 309us/step - loss: 176.0581\n", | |
| "Epoch 58/100\n", | |
| "1030/1030 [==============================] - 0s 291us/step - loss: 174.3966\n", | |
| "Epoch 59/100\n", | |
| "1030/1030 [==============================] - 0s 309us/step - loss: 172.7077\n", | |
| "Epoch 60/100\n", | |
| "1030/1030 [==============================] - 0s 347us/step - loss: 171.2035\n", | |
| "Epoch 61/100\n", | |
| "1030/1030 [==============================] - 0s 291us/step - loss: 169.6094\n", | |
| "Epoch 62/100\n", | |
| "1030/1030 [==============================] - 0s 288us/step - loss: 168.1053\n", | |
| "Epoch 63/100\n", | |
| "1030/1030 [==============================] - 0s 370us/step - loss: 166.6352\n", | |
| "Epoch 64/100\n", | |
| "1030/1030 [==============================] - 0s 294us/step - loss: 165.3265\n", | |
| "Epoch 65/100\n", | |
| "1030/1030 [==============================] - 0s 328us/step - loss: 163.7317\n", | |
| "Epoch 66/100\n", | |
| "1030/1030 [==============================] - 0s 363us/step - loss: 162.3493\n", | |
| "Epoch 67/100\n", | |
| "1030/1030 [==============================] - 0s 329us/step - loss: 161.0565\n", | |
| "Epoch 68/100\n", | |
| "1030/1030 [==============================] - 0s 312us/step - loss: 159.7717\n", | |
| "Epoch 69/100\n", | |
| "1030/1030 [==============================] - 0s 331us/step - loss: 158.5343\n", | |
| "Epoch 70/100\n", | |
| "1030/1030 [==============================] - 0s 314us/step - loss: 157.3039\n", | |
| "Epoch 71/100\n", | |
| "1030/1030 [==============================] - 0s 328us/step - loss: 156.0848\n", | |
| "Epoch 72/100\n", | |
| "1030/1030 [==============================] - 0s 309us/step - loss: 154.9336\n", | |
| "Epoch 73/100\n", | |
| "1030/1030 [==============================] - 0s 311us/step - loss: 153.8238\n", | |
| "Epoch 74/100\n", | |
| "1030/1030 [==============================] - 0s 325us/step - loss: 152.5466\n", | |
| "Epoch 75/100\n", | |
| "1030/1030 [==============================] - 0s 390us/step - loss: 151.4275\n", | |
| "Epoch 76/100\n", | |
| "1030/1030 [==============================] - 0s 327us/step - loss: 150.2465\n", | |
| "Epoch 77/100\n", | |
| "1030/1030 [==============================] - 0s 336us/step - loss: 149.1214\n", | |
| "Epoch 78/100\n", | |
| "1030/1030 [==============================] - 0s 324us/step - loss: 148.1022\n", | |
| "Epoch 79/100\n", | |
| "1030/1030 [==============================] - 0s 289us/step - loss: 146.9774\n", | |
| "Epoch 80/100\n", | |
| "1030/1030 [==============================] - 0s 332us/step - loss: 145.8515\n", | |
| "Epoch 81/100\n", | |
| "1030/1030 [==============================] - 0s 308us/step - loss: 144.8012\n", | |
| "Epoch 82/100\n", | |
| "1030/1030 [==============================] - 0s 291us/step - loss: 143.7763\n", | |
| "Epoch 83/100\n", | |
| "1030/1030 [==============================] - 1s 508us/step - loss: 142.6318\n", | |
| "Epoch 84/100\n", | |
| "1030/1030 [==============================] - 0s 416us/step - loss: 141.6020\n", | |
| "Epoch 85/100\n", | |
| "1030/1030 [==============================] - 0s 325us/step - loss: 140.5714\n", | |
| "Epoch 86/100\n", | |
| "1030/1030 [==============================] - 0s 327us/step - loss: 139.4628\n", | |
| "Epoch 87/100\n", | |
| "1030/1030 [==============================] - 0s 327us/step - loss: 138.4585\n", | |
| "Epoch 88/100\n", | |
| "1030/1030 [==============================] - 0s 330us/step - loss: 137.2836\n", | |
| "Epoch 89/100\n", | |
| "1030/1030 [==============================] - 0s 347us/step - loss: 136.3257\n", | |
| "Epoch 90/100\n", | |
| "1030/1030 [==============================] - 0s 330us/step - loss: 135.1306\n", | |
| "Epoch 91/100\n", | |
| "1030/1030 [==============================] - 0s 330us/step - loss: 134.1993\n", | |
| "Epoch 92/100\n", | |
| "1030/1030 [==============================] - 0s 404us/step - loss: 133.2422\n", | |
| "Epoch 93/100\n", | |
| "1030/1030 [==============================] - 0s 331us/step - loss: 132.1273\n", | |
| "Epoch 94/100\n", | |
| "1030/1030 [==============================] - 0s 327us/step - loss: 131.0634\n", | |
| "Epoch 95/100\n", | |
| "1030/1030 [==============================] - 0s 425us/step - loss: 130.1302\n", | |
| "Epoch 96/100\n", | |
| "1030/1030 [==============================] - 0s 313us/step - loss: 129.1420\n", | |
| "Epoch 97/100\n", | |
| "1030/1030 [==============================] - 0s 348us/step - loss: 128.1359\n", | |
| "Epoch 98/100\n", | |
| "1030/1030 [==============================] - 0s 326us/step - loss: 127.2496\n", | |
| "Epoch 99/100\n", | |
| "1030/1030 [==============================] - 0s 390us/step - loss: 126.3865\n", | |
| "Epoch 100/100\n", | |
| "1030/1030 [==============================] - 1s 695us/step - loss: 125.4178\n" | |
| ] | |
| }, | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "<keras.callbacks.History at 0x7f7c500c6c50>" | |
| ] | |
| }, | |
| "execution_count": 48, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "model.fit(X_norm, y, epochs=100, verbose=1)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 33, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "ename": "NameError", | |
| "evalue": "name 'loss' is not defined", | |
| "output_type": "error", | |
| "traceback": [ | |
| "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
| "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", | |
| "\u001b[0;32m<ipython-input-33-9c7d9083178b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mloss\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", | |
| "\u001b[0;31mNameError\u001b[0m: name 'loss' is not defined" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "model.evaluate()" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python", | |
| "language": "python", | |
| "name": "conda-env-python-py" | |
| }, | |
| "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.6.10" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 4 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment