Kaggle: Titanic: Machine Learning from Disaster

https://www.kaggle.com/c/titanic

In [8]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
np.random.seed(123)

from tensorflow import set_random_seed
set_random_seed(123)

train = pd.read_csv('titanic/train.csv', index_col=0)
test = pd.read_csv('titanic/test.csv', index_col=0)
In [3]:
train.head()
Out[3]:
Survived Pclass Name Sex Age SibSp Parch Ticket Fare Cabin Embarked
PassengerId
1 0 3 Braund, Mr. Owen Harris male 22.0 1 0 A/5 21171 7.2500 NaN S
2 1 1 Cumings, Mrs. John Bradley (Florence Briggs Th... female 38.0 1 0 PC 17599 71.2833 C85 C
3 1 3 Heikkinen, Miss. Laina female 26.0 0 0 STON/O2. 3101282 7.9250 NaN S
4 1 1 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35.0 1 0 113803 53.1000 C123 S
5 0 3 Allen, Mr. William Henry male 35.0 0 0 373450 8.0500 NaN S

Drop Survived and Ticket, then combine train with test

In [4]:
train_tmp = train.drop(['Survived', 'Ticket'], axis=1)
test_tmp = test.drop(['Ticket'], axis=1)
df = pd.concat([train_tmp, test_tmp])
df.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 1309 entries, 1 to 1309
Data columns (total 9 columns):
Pclass      1309 non-null int64
Name        1309 non-null object
Sex         1309 non-null object
Age         1046 non-null float64
SibSp       1309 non-null int64
Parch       1309 non-null int64
Fare        1308 non-null float64
Cabin       295 non-null object
Embarked    1307 non-null object
dtypes: float64(2), int64(3), object(4)
memory usage: 102.3+ KB

Name --> Title --> Number

In [5]:
# Name to Title
df = df.assign(Title=df.Name.str.extract(' ([A-Za-z]+)\..', expand=True))
title_list = df.Title.unique()
print(title_list)
['Mr' 'Mrs' 'Miss' 'Master' 'Don' 'Rev' 'Dr' 'Mme' 'Ms' 'Major' 'Lady'
 'Sir' 'Mlle' 'Col' 'Capt' 'Countess' 'Jonkheer' 'Dona']
In [6]:
# Title to Number(0-17)
df.Title = df.Title.replace(df.Title.unique(), np.arange(len(df.Title.unique())))

# Drop Name column
df = df.drop(['Name'], axis=1)
df.head()
Out[6]:
Pclass Sex Age SibSp Parch Fare Cabin Embarked Title
PassengerId
1 3 male 22.0 1 0 7.2500 NaN S Mr
2 1 female 38.0 1 0 71.2833 C85 C Mrs
3 3 female 26.0 0 0 7.9250 NaN S Miss
4 1 female 35.0 1 0 53.1000 C123 S Mrs
5 3 male 35.0 0 0 8.0500 NaN S Mr

Sex --> male:0, female:1

In [1501]:
df.Sex = df.Sex.replace({'male': 0, 'female': 1})

Cabin --> Number: nan:0, C:1, E:2, G:3, D:4, A:5, B:6, F:7, T:8

In [1502]:
df = df.assign(Cabin=df.Cabin.str[0])
cabin_list = df.Cabin.unique()

df.Cabin = df.Cabin.replace(df.Cabin.str[0].unique(), np.arange(len(df.Cabin.str[0].unique())))

print(cabin_list)
print(df.Cabin.unique())
[nan 'C' 'E' 'G' 'D' 'A' 'B' 'F' 'T']
[0 1 2 3 4 5 6 7 8]

Embarked --> S:0, C:1, Q:2, nan

In [1503]:
df.Embarked.unique()
Out[1503]:
array(['S', 'C', 'Q', nan], dtype=object)
In [1504]:
df.Embarked = df.Embarked.replace({'S':0, 'C':1, 'Q':2})

zscore or normalization:

  • Age: including NaN
  • Fare: including NaN

Z = (x - x.mean) / x.std
N = (x - x.min)/(x.max - x.min)

sklearn.preprocessing.MinMaxScaler causes error with Null data.

In [1505]:
# Normalize Function
def normalize(df_col):
    df_col = (df_col - df_col.min()) / (df_col.max() - df_col.min())
    return df_col
In [1506]:
# Standardization(zscore)
def zscore(df_col):
    df_col = (df_col - df_col.mean()) / df_col.std()
    return df_col
In [1507]:
df.Age = zscore(df.Age)
df.Fare = zscore(df.Fare)

# df.Age = normalize(df.Age)
# df.Fare = normalize(df.Fare)

# for col in df.columns:
#     df[col] = zscore(df[col])

df.describe()
Out[1507]:
Pclass Sex Age SibSp Parch Fare Cabin Embarked Title_Capt Title_Col ... Title_Major Title_Master Title_Miss Title_Mlle Title_Mme Title_Mr Title_Mrs Title_Ms Title_Rev Title_Sir
count 1309.000000 1309.000000 1.046000e+03 1309.000000 1309.000000 1.308000e+03 1309.000000 1307.000000 1309.000000 1309.000000 ... 1309.000000 1309.000000 1309.000000 1309.000000 1309.000000 1309.000000 1309.000000 1309.000000 1309.000000 1309.000000
mean 2.294882 0.355997 9.488904e-17 0.498854 0.385027 -6.049357e-16 0.786860 0.394797 0.000764 0.003056 ... 0.001528 0.046600 0.198625 0.001528 0.000764 0.578304 0.150497 0.001528 0.006112 0.000764
std 0.837836 0.478997 1.000000e+00 1.041658 0.865560 1.000000e+00 1.794388 0.653817 0.027639 0.055216 ... 0.039073 0.210862 0.399117 0.039073 0.027639 0.494019 0.357694 0.039073 0.077967 0.027639
min 1.000000 0.000000 -2.061342e+00 0.000000 0.000000 -6.432832e-01 0.000000 0.000000 0.000000 0.000000 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
25% 2.000000 0.000000 -6.161683e-01 0.000000 0.000000 -4.907329e-01 0.000000 0.000000 0.000000 0.000000 ... 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
50% 3.000000 0.000000 -1.305123e-01 0.000000 0.000000 -3.640217e-01 0.000000 0.000000 0.000000 0.000000 ... 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000
75% 3.000000 1.000000 6.326615e-01 1.000000 0.000000 -3.903654e-02 0.000000 1.000000 0.000000 0.000000 ... 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000
max 3.000000 1.000000 3.477218e+00 8.000000 9.000000 9.255140e+00 8.000000 2.000000 1.000000 1.000000 ... 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000

8 rows × 26 columns

Separate Notnull data from Null data

Make a Copy of df: df0 = df.copy()

  • Age
  • Embarked
  • Fare
In [1508]:
df0 = df.copy()
df0.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 1309 entries, 1 to 1309
Data columns (total 26 columns):
Pclass            1309 non-null int64
Sex               1309 non-null int64
Age               1046 non-null float64
SibSp             1309 non-null int64
Parch             1309 non-null int64
Fare              1308 non-null float64
Cabin             1309 non-null int64
Embarked          1307 non-null float64
Title_Capt        1309 non-null uint8
Title_Col         1309 non-null uint8
Title_Countess    1309 non-null uint8
Title_Don         1309 non-null uint8
Title_Dona        1309 non-null uint8
Title_Dr          1309 non-null uint8
Title_Jonkheer    1309 non-null uint8
Title_Lady        1309 non-null uint8
Title_Major       1309 non-null uint8
Title_Master      1309 non-null uint8
Title_Miss        1309 non-null uint8
Title_Mlle        1309 non-null uint8
Title_Mme         1309 non-null uint8
Title_Mr          1309 non-null uint8
Title_Mrs         1309 non-null uint8
Title_Ms          1309 non-null uint8
Title_Rev         1309 non-null uint8
Title_Sir         1309 non-null uint8
dtypes: float64(3), int64(5), uint8(18)
memory usage: 115.0 KB
In [1509]:
Age_null = df[df.Age.isnull()]
df = df[df.Age.notnull()]

Embarked_null = df[df.Embarked.isnull()]
df = df[df.Embarked.notnull()]

Fare_null = df[df.Fare.isnull()]
df = df[df.Fare.notnull()]

Notnull Data: df.shape = (1043, 9)

In [1510]:
print(df.shape)
df.info()
(1043, 26)
<class 'pandas.core.frame.DataFrame'>
Int64Index: 1043 entries, 1 to 1307
Data columns (total 26 columns):
Pclass            1043 non-null int64
Sex               1043 non-null int64
Age               1043 non-null float64
SibSp             1043 non-null int64
Parch             1043 non-null int64
Fare              1043 non-null float64
Cabin             1043 non-null int64
Embarked          1043 non-null float64
Title_Capt        1043 non-null uint8
Title_Col         1043 non-null uint8
Title_Countess    1043 non-null uint8
Title_Don         1043 non-null uint8
Title_Dona        1043 non-null uint8
Title_Dr          1043 non-null uint8
Title_Jonkheer    1043 non-null uint8
Title_Lady        1043 non-null uint8
Title_Major       1043 non-null uint8
Title_Master      1043 non-null uint8
Title_Miss        1043 non-null uint8
Title_Mlle        1043 non-null uint8
Title_Mme         1043 non-null uint8
Title_Mr          1043 non-null uint8
Title_Mrs         1043 non-null uint8
Title_Ms          1043 non-null uint8
Title_Rev         1043 non-null uint8
Title_Sir         1043 non-null uint8
dtypes: float64(3), int64(5), uint8(18)
memory usage: 91.7 KB

Model to fill NaN in Fare, Embarked, Age

In [1511]:
from keras.models import Sequential
from keras.layers import Flatten, Dense, Dropout, BatchNormalization

# model for Fare, Embarked, Age
def fill_data(col):
    n_cols = len(df.columns) - 1
    num = len(df[col].unique())
    
    model = Sequential()
    model.add(Dense(64, activation='relu', input_shape=(n_cols,)))
    model.add(Dropout(0.5))
    model.add(Dense(32, activation='relu'))
    model.add(Dropout(0.5))
    
    if col == 'Embarked':
        model.add(Dense(num, activation='softmax'))
        model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['acc'])
    else: # 'Fare', 'Age'
        model.add(Dense(1, activation='linear'))
        model.compile(optimizer='rmsprop', loss='mse', metrics=['mae'])
        
    data = df.drop([col], axis=1)
    epochs = 100
    hist = model.fit(data, df[col], epochs=epochs, batch_size=32)

    null_data = df0[df0[col].isnull()]
    null_data = null_data.drop([col], axis=1)
    pred = model.predict(null_data)
    
    if col == 'Embarked':
        pred = pred.argmax(axis=1)
        
        plt.plot(hist.history['acc'], 'b-', label='acc' )
        plt.plot(hist.history['loss'], 'r-', label='loss' )
        plt.xlabel('epochs')
        plt.legend()
        plt.show()
        
    pred = pred.reshape(-1, )
    
    idx = df0[df0[col].isnull()].index.values
    
    for n, i in enumerate(idx):
        df0.loc[i, col] = pred[n]
In [1512]:
fill_data('Embarked') # id:62,830
Epoch 1/100
1043/1043 [==============================] - 3s 3ms/step - loss: 1.0055 - acc: 0.5350
Epoch 2/100
1043/1043 [==============================] - 0s 79us/step - loss: 0.7874 - acc: 0.7143
Epoch 3/100
1043/1043 [==============================] - 0s 77us/step - loss: 0.7494 - acc: 0.7172
Epoch 4/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.7250 - acc: 0.7363
Epoch 5/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.7016 - acc: 0.7498
Epoch 6/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.7047 - acc: 0.7402
Epoch 7/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.7115 - acc: 0.7507
Epoch 8/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.6749 - acc: 0.7536
Epoch 9/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.6990 - acc: 0.7507
Epoch 10/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.6809 - acc: 0.7498
Epoch 11/100
1043/1043 [==============================] - 0s 84us/step - loss: 0.6844 - acc: 0.7488
Epoch 12/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.6618 - acc: 0.7450
Epoch 13/100
1043/1043 [==============================] - 0s 77us/step - loss: 0.6694 - acc: 0.7670
Epoch 14/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.6662 - acc: 0.7565
Epoch 15/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6535 - acc: 0.7546
Epoch 16/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6508 - acc: 0.7603
Epoch 17/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6579 - acc: 0.7565
Epoch 18/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.6616 - acc: 0.7603
Epoch 19/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6437 - acc: 0.7546
Epoch 20/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6559 - acc: 0.7517
Epoch 21/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.6379 - acc: 0.7526
Epoch 22/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.6338 - acc: 0.7593
Epoch 23/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.6266 - acc: 0.7632
Epoch 24/100
1043/1043 [==============================] - 0s 79us/step - loss: 0.6426 - acc: 0.7565
Epoch 25/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6347 - acc: 0.7603
Epoch 26/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.6419 - acc: 0.7622
Epoch 27/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6307 - acc: 0.7555
Epoch 28/100
1043/1043 [==============================] - 0s 80us/step - loss: 0.6284 - acc: 0.7584
Epoch 29/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6143 - acc: 0.7613
Epoch 30/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6245 - acc: 0.7536
Epoch 31/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.6222 - acc: 0.7718
Epoch 32/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6129 - acc: 0.7584
Epoch 33/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6241 - acc: 0.7555
Epoch 34/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6147 - acc: 0.7555
Epoch 35/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.6163 - acc: 0.7546
Epoch 36/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6133 - acc: 0.7584
Epoch 37/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.6204 - acc: 0.7632
Epoch 38/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.6229 - acc: 0.7670
Epoch 39/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.6082 - acc: 0.7632
Epoch 40/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6227 - acc: 0.7728
Epoch 41/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.6098 - acc: 0.7622
Epoch 42/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6039 - acc: 0.7728
Epoch 43/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.6030 - acc: 0.7651
Epoch 44/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5946 - acc: 0.7680
Epoch 45/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.6139 - acc: 0.7661
Epoch 46/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5854 - acc: 0.7776
Epoch 47/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6018 - acc: 0.7651
Epoch 48/100
1043/1043 [==============================] - 0s 77us/step - loss: 0.6061 - acc: 0.7661
Epoch 49/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6083 - acc: 0.7593
Epoch 50/100
1043/1043 [==============================] - 0s 80us/step - loss: 0.5996 - acc: 0.7709
Epoch 51/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5891 - acc: 0.7728
Epoch 52/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5972 - acc: 0.7689
Epoch 53/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5938 - acc: 0.7699
Epoch 54/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.5845 - acc: 0.7632
Epoch 55/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.5719 - acc: 0.7689
Epoch 56/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.5995 - acc: 0.7574
Epoch 57/100
1043/1043 [==============================] - 0s 85us/step - loss: 0.5924 - acc: 0.7709
Epoch 58/100
1043/1043 [==============================] - 0s 81us/step - loss: 0.5937 - acc: 0.7632
Epoch 59/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5977 - acc: 0.7593
Epoch 60/100
1043/1043 [==============================] - 0s 77us/step - loss: 0.5748 - acc: 0.7756
Epoch 61/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5764 - acc: 0.7632
Epoch 62/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.5753 - acc: 0.7737
Epoch 63/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.5815 - acc: 0.7651
Epoch 64/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5864 - acc: 0.7766
Epoch 65/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.5971 - acc: 0.7603
Epoch 66/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.5830 - acc: 0.7833
Epoch 67/100
1043/1043 [==============================] - 0s 79us/step - loss: 0.5780 - acc: 0.7747
Epoch 68/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5643 - acc: 0.7804
Epoch 69/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5781 - acc: 0.7718
Epoch 70/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.5705 - acc: 0.7718
Epoch 71/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5851 - acc: 0.7728
Epoch 72/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.5708 - acc: 0.7680
Epoch 73/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5827 - acc: 0.7728
Epoch 74/100
1043/1043 [==============================] - 0s 80us/step - loss: 0.5755 - acc: 0.7737
Epoch 75/100
1043/1043 [==============================] - 0s 84us/step - loss: 0.5739 - acc: 0.7622
Epoch 76/100
1043/1043 [==============================] - 0s 79us/step - loss: 0.5762 - acc: 0.7651
Epoch 77/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.5853 - acc: 0.7689
Epoch 78/100
1043/1043 [==============================] - 0s 82us/step - loss: 0.5741 - acc: 0.7747
Epoch 79/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.5637 - acc: 0.7718
Epoch 80/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.5650 - acc: 0.7814
Epoch 81/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.5612 - acc: 0.7651
Epoch 82/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.5682 - acc: 0.7824
Epoch 83/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5617 - acc: 0.7785
Epoch 84/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.5711 - acc: 0.7728
Epoch 85/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.5623 - acc: 0.7756
Epoch 86/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.5610 - acc: 0.7718
Epoch 87/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.5796 - acc: 0.7699
Epoch 88/100
1043/1043 [==============================] - 0s 77us/step - loss: 0.5669 - acc: 0.7881
Epoch 89/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.5708 - acc: 0.7718
Epoch 90/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5665 - acc: 0.7747
Epoch 91/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.5663 - acc: 0.7756
Epoch 92/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5630 - acc: 0.7785
Epoch 93/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5667 - acc: 0.7737
Epoch 94/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.5638 - acc: 0.7699
Epoch 95/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.5723 - acc: 0.7728
Epoch 96/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.5578 - acc: 0.7776
Epoch 97/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.5520 - acc: 0.7814
Epoch 98/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5544 - acc: 0.7728
Epoch 99/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.5672 - acc: 0.7804
Epoch 100/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.5574 - acc: 0.7718
In [1513]:
fill_data('Fare') # id:1044
Epoch 1/100
1043/1043 [==============================] - 3s 3ms/step - loss: 1.4221 - mean_absolute_error: 0.7019
Epoch 2/100
1043/1043 [==============================] - 0s 72us/step - loss: 1.1943 - mean_absolute_error: 0.6114
Epoch 3/100
1043/1043 [==============================] - 0s 71us/step - loss: 1.1357 - mean_absolute_error: 0.5726
Epoch 4/100
1043/1043 [==============================] - 0s 71us/step - loss: 1.0853 - mean_absolute_error: 0.5431
Epoch 5/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.9761 - mean_absolute_error: 0.5245
Epoch 6/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.9486 - mean_absolute_error: 0.5070
Epoch 7/100
1043/1043 [==============================] - 0s 77us/step - loss: 0.9139 - mean_absolute_error: 0.5001
Epoch 8/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.9015 - mean_absolute_error: 0.4918
Epoch 9/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.8877 - mean_absolute_error: 0.4892
Epoch 10/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.8116 - mean_absolute_error: 0.4611
Epoch 11/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.8339 - mean_absolute_error: 0.4681
Epoch 12/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.8145 - mean_absolute_error: 0.4652
Epoch 13/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.8042 - mean_absolute_error: 0.4531
Epoch 14/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.8021 - mean_absolute_error: 0.4549
Epoch 15/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.7902 - mean_absolute_error: 0.4480
Epoch 16/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.7817 - mean_absolute_error: 0.4453
Epoch 17/100
1043/1043 [==============================] - 0s 82us/step - loss: 0.7609 - mean_absolute_error: 0.4425
Epoch 18/100
1043/1043 [==============================] - 0s 80us/step - loss: 0.7748 - mean_absolute_error: 0.4440
Epoch 19/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.7385 - mean_absolute_error: 0.4333
Epoch 20/100
1043/1043 [==============================] - 0s 80us/step - loss: 0.7097 - mean_absolute_error: 0.4441
Epoch 21/100
1043/1043 [==============================] - 0s 83us/step - loss: 0.7454 - mean_absolute_error: 0.4313
Epoch 22/100
1043/1043 [==============================] - 0s 81us/step - loss: 0.7190 - mean_absolute_error: 0.4309
Epoch 23/100
1043/1043 [==============================] - 0s 80us/step - loss: 0.7325 - mean_absolute_error: 0.4278
Epoch 24/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.7364 - mean_absolute_error: 0.4274
Epoch 25/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.7144 - mean_absolute_error: 0.4173
Epoch 26/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.6903 - mean_absolute_error: 0.4143
Epoch 27/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6572 - mean_absolute_error: 0.4158
Epoch 28/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6872 - mean_absolute_error: 0.4148
Epoch 29/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.6543 - mean_absolute_error: 0.4117
Epoch 30/100
1043/1043 [==============================] - 0s 79us/step - loss: 0.6758 - mean_absolute_error: 0.4124
Epoch 31/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6529 - mean_absolute_error: 0.3985
Epoch 32/100
1043/1043 [==============================] - 0s 77us/step - loss: 0.6759 - mean_absolute_error: 0.4098
Epoch 33/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.6362 - mean_absolute_error: 0.3984
Epoch 34/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.6660 - mean_absolute_error: 0.3989
Epoch 35/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6919 - mean_absolute_error: 0.4103
Epoch 36/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6787 - mean_absolute_error: 0.4101
Epoch 37/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6319 - mean_absolute_error: 0.3989
Epoch 38/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.6419 - mean_absolute_error: 0.3884
Epoch 39/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.6641 - mean_absolute_error: 0.4035
Epoch 40/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.6466 - mean_absolute_error: 0.3998
Epoch 41/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.6470 - mean_absolute_error: 0.3913
Epoch 42/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6070 - mean_absolute_error: 0.3885
Epoch 43/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.6797 - mean_absolute_error: 0.3988
Epoch 44/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6475 - mean_absolute_error: 0.3909
Epoch 45/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.6224 - mean_absolute_error: 0.3936
Epoch 46/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.6888 - mean_absolute_error: 0.4032
Epoch 47/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.5836 - mean_absolute_error: 0.3787
Epoch 48/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.5982 - mean_absolute_error: 0.3795
Epoch 49/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.5953 - mean_absolute_error: 0.3827
Epoch 50/100
1043/1043 [==============================] - 0s 80us/step - loss: 0.6295 - mean_absolute_error: 0.3795
Epoch 51/100
1043/1043 [==============================] - 0s 79us/step - loss: 0.6180 - mean_absolute_error: 0.3689
Epoch 52/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.6241 - mean_absolute_error: 0.3795
Epoch 53/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.5616 - mean_absolute_error: 0.3802
Epoch 54/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.6189 - mean_absolute_error: 0.3962
Epoch 55/100
1043/1043 [==============================] - 0s 79us/step - loss: 0.6373 - mean_absolute_error: 0.3841
Epoch 56/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.6313 - mean_absolute_error: 0.3833
Epoch 57/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.6143 - mean_absolute_error: 0.3866
Epoch 58/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.5706 - mean_absolute_error: 0.3596
Epoch 59/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5931 - mean_absolute_error: 0.3790
Epoch 60/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6212 - mean_absolute_error: 0.3745
Epoch 61/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6297 - mean_absolute_error: 0.3908
Epoch 62/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.5912 - mean_absolute_error: 0.3655
Epoch 63/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5728 - mean_absolute_error: 0.3689
Epoch 64/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5721 - mean_absolute_error: 0.3706
Epoch 65/100
1043/1043 [==============================] - 0s 87us/step - loss: 0.5948 - mean_absolute_error: 0.3825
Epoch 66/100
1043/1043 [==============================] - 0s 64us/step - loss: 0.5912 - mean_absolute_error: 0.3753
Epoch 67/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5784 - mean_absolute_error: 0.3654
Epoch 68/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.5919 - mean_absolute_error: 0.3583
Epoch 69/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.5631 - mean_absolute_error: 0.3691
Epoch 70/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.5422 - mean_absolute_error: 0.3611
Epoch 71/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5764 - mean_absolute_error: 0.3663
Epoch 72/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.5817 - mean_absolute_error: 0.3615
Epoch 73/100
1043/1043 [==============================] - 0s 66us/step - loss: 0.5965 - mean_absolute_error: 0.3790
Epoch 74/100
1043/1043 [==============================] - 0s 66us/step - loss: 0.5709 - mean_absolute_error: 0.3526
Epoch 75/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.5948 - mean_absolute_error: 0.3538
Epoch 76/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.5885 - mean_absolute_error: 0.3698
Epoch 77/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.5757 - mean_absolute_error: 0.3622
Epoch 78/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5364 - mean_absolute_error: 0.3449
Epoch 79/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5897 - mean_absolute_error: 0.3722
Epoch 80/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.5624 - mean_absolute_error: 0.3596
Epoch 81/100
1043/1043 [==============================] - 0s 66us/step - loss: 0.5456 - mean_absolute_error: 0.3607
Epoch 82/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.6008 - mean_absolute_error: 0.3706
Epoch 83/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5185 - mean_absolute_error: 0.3527
Epoch 84/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.5703 - mean_absolute_error: 0.3559
Epoch 85/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5632 - mean_absolute_error: 0.3605
Epoch 86/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5384 - mean_absolute_error: 0.3561
Epoch 87/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5601 - mean_absolute_error: 0.3659
Epoch 88/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5636 - mean_absolute_error: 0.3586
Epoch 89/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.5919 - mean_absolute_error: 0.3663
Epoch 90/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.5590 - mean_absolute_error: 0.3580
Epoch 91/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.5652 - mean_absolute_error: 0.3545
Epoch 92/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.5613 - mean_absolute_error: 0.3595
Epoch 93/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.4973 - mean_absolute_error: 0.3472
Epoch 94/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.5177 - mean_absolute_error: 0.3378
Epoch 95/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5458 - mean_absolute_error: 0.3462
Epoch 96/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.5295 - mean_absolute_error: 0.3496
Epoch 97/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5514 - mean_absolute_error: 0.3532
Epoch 98/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5851 - mean_absolute_error: 0.3604
Epoch 99/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5378 - mean_absolute_error: 0.3486
Epoch 100/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.5397 - mean_absolute_error: 0.3539
In [1514]:
fill_data('Age') # id: 6,18,20,27,29,30
Epoch 1/100
1043/1043 [==============================] - 3s 3ms/step - loss: 1.2363 - mean_absolute_error: 0.8609
Epoch 2/100
1043/1043 [==============================] - 0s 73us/step - loss: 1.0649 - mean_absolute_error: 0.7896
Epoch 3/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.9711 - mean_absolute_error: 0.7641
Epoch 4/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.9554 - mean_absolute_error: 0.7523
Epoch 5/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.9089 - mean_absolute_error: 0.7359
Epoch 6/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.8579 - mean_absolute_error: 0.7222
Epoch 7/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.8468 - mean_absolute_error: 0.7151
Epoch 8/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.8436 - mean_absolute_error: 0.7126
Epoch 9/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.8104 - mean_absolute_error: 0.7017
Epoch 10/100
1043/1043 [==============================] - 0s 79us/step - loss: 0.8224 - mean_absolute_error: 0.7040
Epoch 11/100
1043/1043 [==============================] - 0s 79us/step - loss: 0.7763 - mean_absolute_error: 0.6906
Epoch 12/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.7487 - mean_absolute_error: 0.6867
Epoch 13/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.7893 - mean_absolute_error: 0.6902
Epoch 14/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.7305 - mean_absolute_error: 0.6676
Epoch 15/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.7276 - mean_absolute_error: 0.6674
Epoch 16/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.7351 - mean_absolute_error: 0.6738
Epoch 17/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.7433 - mean_absolute_error: 0.6771
Epoch 18/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.7257 - mean_absolute_error: 0.6712
Epoch 19/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.6910 - mean_absolute_error: 0.6563
Epoch 20/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.7006 - mean_absolute_error: 0.6587
Epoch 21/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.7131 - mean_absolute_error: 0.6643
Epoch 22/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.6795 - mean_absolute_error: 0.6518
Epoch 23/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.7009 - mean_absolute_error: 0.6589
Epoch 24/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.7171 - mean_absolute_error: 0.6634
Epoch 25/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.6655 - mean_absolute_error: 0.6454
Epoch 26/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.6668 - mean_absolute_error: 0.6394
Epoch 27/100
1043/1043 [==============================] - 0s 66us/step - loss: 0.6807 - mean_absolute_error: 0.6520
Epoch 28/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.6471 - mean_absolute_error: 0.6286
Epoch 29/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6829 - mean_absolute_error: 0.6472
Epoch 30/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.6564 - mean_absolute_error: 0.6366
Epoch 31/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.6962 - mean_absolute_error: 0.6560
Epoch 32/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.6751 - mean_absolute_error: 0.6465
Epoch 33/100
1043/1043 [==============================] - 0s 77us/step - loss: 0.6519 - mean_absolute_error: 0.6342
Epoch 34/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.6623 - mean_absolute_error: 0.6395
Epoch 35/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.6572 - mean_absolute_error: 0.6296
Epoch 36/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.6631 - mean_absolute_error: 0.6395
Epoch 37/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.6516 - mean_absolute_error: 0.6363
Epoch 38/100
1043/1043 [==============================] - 0s 82us/step - loss: 0.6575 - mean_absolute_error: 0.6341
Epoch 39/100
1043/1043 [==============================] - 0s 80us/step - loss: 0.6104 - mean_absolute_error: 0.6123
Epoch 40/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.6655 - mean_absolute_error: 0.6360
Epoch 41/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.6445 - mean_absolute_error: 0.6322
Epoch 42/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6409 - mean_absolute_error: 0.6365
Epoch 43/100
1043/1043 [==============================] - 0s 66us/step - loss: 0.6692 - mean_absolute_error: 0.6357
Epoch 44/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.6239 - mean_absolute_error: 0.6194
Epoch 45/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6576 - mean_absolute_error: 0.6377
Epoch 46/100
1043/1043 [==============================] - 0s 75us/step - loss: 0.6083 - mean_absolute_error: 0.6083
Epoch 47/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6301 - mean_absolute_error: 0.6250
Epoch 48/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.6446 - mean_absolute_error: 0.6327
Epoch 49/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.6340 - mean_absolute_error: 0.6259
Epoch 50/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.6071 - mean_absolute_error: 0.6070
Epoch 51/100
1043/1043 [==============================] - 0s 66us/step - loss: 0.6283 - mean_absolute_error: 0.6224
Epoch 52/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.6469 - mean_absolute_error: 0.6298
Epoch 53/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.6364 - mean_absolute_error: 0.6231
Epoch 54/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.6324 - mean_absolute_error: 0.6284
Epoch 55/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.6039 - mean_absolute_error: 0.6078
Epoch 56/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.6148 - mean_absolute_error: 0.6135
Epoch 57/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.6085 - mean_absolute_error: 0.6128
Epoch 58/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.6289 - mean_absolute_error: 0.6224
Epoch 59/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.6131 - mean_absolute_error: 0.6157
Epoch 60/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.6043 - mean_absolute_error: 0.6040
Epoch 61/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.5838 - mean_absolute_error: 0.5992
Epoch 62/100
1043/1043 [==============================] - 0s 65us/step - loss: 0.6040 - mean_absolute_error: 0.6100
Epoch 63/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.6041 - mean_absolute_error: 0.6097
Epoch 64/100
1043/1043 [==============================] - 0s 74us/step - loss: 0.6120 - mean_absolute_error: 0.6113
Epoch 65/100
1043/1043 [==============================] - 0s 65us/step - loss: 0.6036 - mean_absolute_error: 0.6084
Epoch 66/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5903 - mean_absolute_error: 0.6042
Epoch 67/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.6037 - mean_absolute_error: 0.6058
Epoch 68/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.6031 - mean_absolute_error: 0.6098
Epoch 69/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.6220 - mean_absolute_error: 0.6136
Epoch 70/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.6183 - mean_absolute_error: 0.6165
Epoch 71/100
1043/1043 [==============================] - 0s 66us/step - loss: 0.5952 - mean_absolute_error: 0.6034
Epoch 72/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.6159 - mean_absolute_error: 0.6142
Epoch 73/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6087 - mean_absolute_error: 0.6080
Epoch 74/100
1043/1043 [==============================] - 0s 73us/step - loss: 0.5886 - mean_absolute_error: 0.5932
Epoch 75/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.5954 - mean_absolute_error: 0.6029
Epoch 76/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5933 - mean_absolute_error: 0.6002
Epoch 77/100
1043/1043 [==============================] - 0s 66us/step - loss: 0.5839 - mean_absolute_error: 0.6022
Epoch 78/100
1043/1043 [==============================] - 0s 69us/step - loss: 0.5753 - mean_absolute_error: 0.5890
Epoch 79/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5737 - mean_absolute_error: 0.5850
Epoch 80/100
1043/1043 [==============================] - 0s 67us/step - loss: 0.5820 - mean_absolute_error: 0.5939
Epoch 81/100
1043/1043 [==============================] - 0s 66us/step - loss: 0.6174 - mean_absolute_error: 0.6145
Epoch 82/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5758 - mean_absolute_error: 0.5913
Epoch 83/100
1043/1043 [==============================] - 0s 65us/step - loss: 0.5679 - mean_absolute_error: 0.5874
Epoch 84/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5773 - mean_absolute_error: 0.6004
Epoch 85/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.5761 - mean_absolute_error: 0.5887
Epoch 86/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.6123 - mean_absolute_error: 0.6115
Epoch 87/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5876 - mean_absolute_error: 0.5959
Epoch 88/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.5828 - mean_absolute_error: 0.5892
Epoch 89/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5974 - mean_absolute_error: 0.5989
Epoch 90/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5713 - mean_absolute_error: 0.5944
Epoch 91/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5969 - mean_absolute_error: 0.5975
Epoch 92/100
1043/1043 [==============================] - 0s 78us/step - loss: 0.5962 - mean_absolute_error: 0.6025
Epoch 93/100
1043/1043 [==============================] - 0s 72us/step - loss: 0.5904 - mean_absolute_error: 0.6017
Epoch 94/100
1043/1043 [==============================] - 0s 70us/step - loss: 0.5861 - mean_absolute_error: 0.5995
Epoch 95/100
1043/1043 [==============================] - 0s 65us/step - loss: 0.5957 - mean_absolute_error: 0.6029
Epoch 96/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5732 - mean_absolute_error: 0.5929
Epoch 97/100
1043/1043 [==============================] - 0s 68us/step - loss: 0.5948 - mean_absolute_error: 0.6004
Epoch 98/100
1043/1043 [==============================] - 0s 71us/step - loss: 0.5779 - mean_absolute_error: 0.5948
Epoch 99/100
1043/1043 [==============================] - 0s 66us/step - loss: 0.5921 - mean_absolute_error: 0.5957
Epoch 100/100
1043/1043 [==============================] - 0s 76us/step - loss: 0.5800 - mean_absolute_error: 0.5942
In [1517]:
train0 = df0[0:891].copy()
test0 = df0[891:].copy()

Model to estimate Survived for submission

In [1518]:
df0_cols = len(df0.columns)

model = Sequential()
model.add(Dense(64, activation='relu', input_shape=(df0_cols,)))
model.add(Dropout(0.5))
model.add(Dense(32, activation='relu'))
model.add(Dropout(0.5))

model.add(Dense(2, activation='softmax'))
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['acc'])

epochs=300
hist = model.fit(train0, train.Survived, epochs=epochs, batch_size=5)

pred = model.predict(test0)
Epoch 1/300
891/891 [==============================] - 3s 4ms/step - loss: 0.6436 - acc: 0.6667
Epoch 2/300
891/891 [==============================] - 0s 421us/step - loss: 0.5247 - acc: 0.7464
Epoch 3/300
891/891 [==============================] - 0s 426us/step - loss: 0.5265 - acc: 0.7576
Epoch 4/300
891/891 [==============================] - 0s 417us/step - loss: 0.5045 - acc: 0.7901
Epoch 5/300
891/891 [==============================] - 0s 420us/step - loss: 0.4819 - acc: 0.7935
Epoch 6/300
891/891 [==============================] - 0s 434us/step - loss: 0.4564 - acc: 0.8081
Epoch 7/300
891/891 [==============================] - 0s 416us/step - loss: 0.4491 - acc: 0.8171
Epoch 8/300
891/891 [==============================] - 0s 490us/step - loss: 0.4387 - acc: 0.8215
Epoch 9/300
891/891 [==============================] - 0s 491us/step - loss: 0.4468 - acc: 0.8114
Epoch 10/300
891/891 [==============================] - 0s 418us/step - loss: 0.4530 - acc: 0.8249
Epoch 11/300
891/891 [==============================] - 0s 424us/step - loss: 0.4452 - acc: 0.8092
Epoch 12/300
891/891 [==============================] - 0s 414us/step - loss: 0.4237 - acc: 0.8361
Epoch 13/300
891/891 [==============================] - 0s 426us/step - loss: 0.4245 - acc: 0.8361
Epoch 14/300
891/891 [==============================] - 0s 427us/step - loss: 0.4375 - acc: 0.8283
Epoch 15/300
891/891 [==============================] - 0s 422us/step - loss: 0.4295 - acc: 0.8350
Epoch 16/300
891/891 [==============================] - 0s 427us/step - loss: 0.4209 - acc: 0.8294
Epoch 17/300
891/891 [==============================] - 0s 424us/step - loss: 0.4312 - acc: 0.8227
Epoch 18/300
891/891 [==============================] - 0s 495us/step - loss: 0.4225 - acc: 0.8283
Epoch 19/300
891/891 [==============================] - 0s 471us/step - loss: 0.4214 - acc: 0.8316
Epoch 20/300
891/891 [==============================] - 0s 536us/step - loss: 0.4205 - acc: 0.8305
Epoch 21/300
891/891 [==============================] - 0s 500us/step - loss: 0.3943 - acc: 0.8462
Epoch 22/300
891/891 [==============================] - 0s 498us/step - loss: 0.4137 - acc: 0.8418
Epoch 23/300
891/891 [==============================] - 0s 449us/step - loss: 0.3907 - acc: 0.8406
Epoch 24/300
891/891 [==============================] - 0s 460us/step - loss: 0.4048 - acc: 0.8361
Epoch 25/300
891/891 [==============================] - 0s 435us/step - loss: 0.4029 - acc: 0.8395
Epoch 26/300
891/891 [==============================] - 0s 452us/step - loss: 0.4138 - acc: 0.8328
Epoch 27/300
891/891 [==============================] - 0s 431us/step - loss: 0.4136 - acc: 0.8283
Epoch 28/300
891/891 [==============================] - 0s 452us/step - loss: 0.3948 - acc: 0.8418
Epoch 29/300
891/891 [==============================] - 0s 432us/step - loss: 0.4084 - acc: 0.8339
Epoch 30/300
891/891 [==============================] - 0s 532us/step - loss: 0.3949 - acc: 0.8440
Epoch 31/300
891/891 [==============================] - 0s 514us/step - loss: 0.3842 - acc: 0.8530
Epoch 32/300
891/891 [==============================] - 0s 505us/step - loss: 0.4046 - acc: 0.8373
Epoch 33/300
891/891 [==============================] - 0s 499us/step - loss: 0.3997 - acc: 0.8406
Epoch 34/300
891/891 [==============================] - 0s 501us/step - loss: 0.3888 - acc: 0.8597
Epoch 35/300
891/891 [==============================] - 0s 425us/step - loss: 0.3970 - acc: 0.8406
Epoch 36/300
891/891 [==============================] - 0s 423us/step - loss: 0.3822 - acc: 0.8418
Epoch 37/300
891/891 [==============================] - 0s 420us/step - loss: 0.3816 - acc: 0.8496
Epoch 38/300
891/891 [==============================] - 0s 428us/step - loss: 0.3950 - acc: 0.8496
Epoch 39/300
891/891 [==============================] - 0s 426us/step - loss: 0.3755 - acc: 0.8485
Epoch 40/300
891/891 [==============================] - 0s 432us/step - loss: 0.3896 - acc: 0.8328
Epoch 41/300
891/891 [==============================] - 0s 435us/step - loss: 0.3899 - acc: 0.8575
Epoch 42/300
891/891 [==============================] - 0s 424us/step - loss: 0.3710 - acc: 0.8519
Epoch 43/300
891/891 [==============================] - 0s 433us/step - loss: 0.3841 - acc: 0.8462
Epoch 44/300
891/891 [==============================] - 0s 427us/step - loss: 0.3828 - acc: 0.8418
Epoch 45/300
891/891 [==============================] - 0s 435us/step - loss: 0.3807 - acc: 0.8541
Epoch 46/300
891/891 [==============================] - 0s 421us/step - loss: 0.3768 - acc: 0.8519
Epoch 47/300
891/891 [==============================] - 0s 423us/step - loss: 0.3909 - acc: 0.8541
Epoch 48/300
891/891 [==============================] - 0s 437us/step - loss: 0.3795 - acc: 0.8541
Epoch 49/300
891/891 [==============================] - 0s 430us/step - loss: 0.3629 - acc: 0.8530
Epoch 50/300
891/891 [==============================] - 0s 425us/step - loss: 0.3775 - acc: 0.8485
Epoch 51/300
891/891 [==============================] - 0s 439us/step - loss: 0.3706 - acc: 0.8485
Epoch 52/300
891/891 [==============================] - 0s 426us/step - loss: 0.3812 - acc: 0.8485
Epoch 53/300
891/891 [==============================] - 0s 439us/step - loss: 0.3757 - acc: 0.8541
Epoch 54/300
891/891 [==============================] - 0s 433us/step - loss: 0.3697 - acc: 0.8440
Epoch 55/300
891/891 [==============================] - 0s 427us/step - loss: 0.3838 - acc: 0.8519
Epoch 56/300
891/891 [==============================] - 0s 435us/step - loss: 0.3723 - acc: 0.8485
Epoch 57/300
891/891 [==============================] - 0s 427us/step - loss: 0.3684 - acc: 0.8429
Epoch 58/300
891/891 [==============================] - 0s 434us/step - loss: 0.3633 - acc: 0.8586
Epoch 59/300
891/891 [==============================] - 0s 434us/step - loss: 0.3671 - acc: 0.8709
Epoch 60/300
891/891 [==============================] - 0s 416us/step - loss: 0.3753 - acc: 0.8462
Epoch 61/300
891/891 [==============================] - 0s 524us/step - loss: 0.3659 - acc: 0.8586
Epoch 62/300
891/891 [==============================] - 0s 489us/step - loss: 0.3600 - acc: 0.8620
Epoch 63/300
891/891 [==============================] - 0s 502us/step - loss: 0.3771 - acc: 0.8474
Epoch 64/300
891/891 [==============================] - 0s 469us/step - loss: 0.3642 - acc: 0.8620
Epoch 65/300
891/891 [==============================] - 0s 432us/step - loss: 0.3609 - acc: 0.8620
Epoch 66/300
891/891 [==============================] - 0s 437us/step - loss: 0.3674 - acc: 0.8586
Epoch 67/300
891/891 [==============================] - 0s 428us/step - loss: 0.3679 - acc: 0.8496
Epoch 68/300
891/891 [==============================] - 0s 440us/step - loss: 0.3458 - acc: 0.8620
Epoch 69/300
891/891 [==============================] - 0s 433us/step - loss: 0.3678 - acc: 0.8631
Epoch 70/300
891/891 [==============================] - 0s 430us/step - loss: 0.3675 - acc: 0.8642
Epoch 71/300
891/891 [==============================] - 0s 437us/step - loss: 0.3448 - acc: 0.8687
Epoch 72/300
891/891 [==============================] - 0s 427us/step - loss: 0.3574 - acc: 0.8530
Epoch 73/300
891/891 [==============================] - 0s 444us/step - loss: 0.3837 - acc: 0.8418
Epoch 74/300
891/891 [==============================] - 0s 429us/step - loss: 0.3468 - acc: 0.8575
Epoch 75/300
891/891 [==============================] - 0s 428us/step - loss: 0.3501 - acc: 0.8687
Epoch 76/300
891/891 [==============================] - 0s 441us/step - loss: 0.3681 - acc: 0.8507
Epoch 77/300
891/891 [==============================] - 0s 429us/step - loss: 0.3574 - acc: 0.8642
Epoch 78/300
891/891 [==============================] - 0s 429us/step - loss: 0.3550 - acc: 0.8440
Epoch 79/300
891/891 [==============================] - 0s 435us/step - loss: 0.3595 - acc: 0.8485
Epoch 80/300
891/891 [==============================] - 0s 427us/step - loss: 0.3530 - acc: 0.8664
Epoch 81/300
891/891 [==============================] - 0s 439us/step - loss: 0.3593 - acc: 0.8631
Epoch 82/300
891/891 [==============================] - 0s 434us/step - loss: 0.3634 - acc: 0.8608
Epoch 83/300
891/891 [==============================] - 0s 417us/step - loss: 0.3663 - acc: 0.8608
Epoch 84/300
891/891 [==============================] - 0s 412us/step - loss: 0.3556 - acc: 0.8530
Epoch 85/300
891/891 [==============================] - 0s 412us/step - loss: 0.3609 - acc: 0.8664
Epoch 86/300
891/891 [==============================] - 0s 401us/step - loss: 0.3446 - acc: 0.8575
Epoch 87/300
891/891 [==============================] - 0s 416us/step - loss: 0.3534 - acc: 0.8653
Epoch 88/300
891/891 [==============================] - 0s 403us/step - loss: 0.3654 - acc: 0.8653
Epoch 89/300
891/891 [==============================] - 0s 414us/step - loss: 0.3544 - acc: 0.8507
Epoch 90/300
891/891 [==============================] - 0s 415us/step - loss: 0.3628 - acc: 0.8597
Epoch 91/300
891/891 [==============================] - 0s 497us/step - loss: 0.3518 - acc: 0.8709
Epoch 92/300
891/891 [==============================] - 0s 531us/step - loss: 0.3498 - acc: 0.8507
Epoch 93/300
891/891 [==============================] - 0s 472us/step - loss: 0.3486 - acc: 0.8676
Epoch 94/300
891/891 [==============================] - 0s 465us/step - loss: 0.3629 - acc: 0.8698
Epoch 95/300
891/891 [==============================] - 0s 446us/step - loss: 0.3485 - acc: 0.8608
Epoch 96/300
891/891 [==============================] - 0s 454us/step - loss: 0.3397 - acc: 0.8620
Epoch 97/300
891/891 [==============================] - 0s 470us/step - loss: 0.3582 - acc: 0.8586
Epoch 98/300
891/891 [==============================] - 0s 427us/step - loss: 0.3405 - acc: 0.8687
Epoch 99/300
891/891 [==============================] - 0s 471us/step - loss: 0.3577 - acc: 0.8631
Epoch 100/300
891/891 [==============================] - 0s 460us/step - loss: 0.3600 - acc: 0.8575
Epoch 101/300
891/891 [==============================] - 0s 440us/step - loss: 0.3347 - acc: 0.8687
Epoch 102/300
891/891 [==============================] - 0s 417us/step - loss: 0.3495 - acc: 0.8620
Epoch 103/300
891/891 [==============================] - 0s 431us/step - loss: 0.3431 - acc: 0.8620
Epoch 104/300
891/891 [==============================] - 0s 437us/step - loss: 0.3571 - acc: 0.8552
Epoch 105/300
891/891 [==============================] - 0s 433us/step - loss: 0.3522 - acc: 0.8541
Epoch 106/300
891/891 [==============================] - 0s 463us/step - loss: 0.3393 - acc: 0.8631
Epoch 107/300
891/891 [==============================] - 0s 463us/step - loss: 0.3375 - acc: 0.8664
Epoch 108/300
891/891 [==============================] - 0s 428us/step - loss: 0.3444 - acc: 0.8563
Epoch 109/300
891/891 [==============================] - 0s 436us/step - loss: 0.3557 - acc: 0.8642
Epoch 110/300
891/891 [==============================] - 0s 426us/step - loss: 0.3549 - acc: 0.8620
Epoch 111/300
891/891 [==============================] - 0s 425us/step - loss: 0.3390 - acc: 0.8608
Epoch 112/300
891/891 [==============================] - 0s 425us/step - loss: 0.3396 - acc: 0.8698
Epoch 113/300
891/891 [==============================] - 0s 427us/step - loss: 0.3393 - acc: 0.8721
Epoch 114/300
891/891 [==============================] - 0s 436us/step - loss: 0.3435 - acc: 0.8732
Epoch 115/300
891/891 [==============================] - 0s 424us/step - loss: 0.3298 - acc: 0.8631
Epoch 116/300
891/891 [==============================] - 0s 425us/step - loss: 0.3393 - acc: 0.8608
Epoch 117/300
891/891 [==============================] - 0s 440us/step - loss: 0.3420 - acc: 0.8687
Epoch 118/300
891/891 [==============================] - 0s 429us/step - loss: 0.3459 - acc: 0.8552
Epoch 119/300
891/891 [==============================] - 0s 426us/step - loss: 0.3405 - acc: 0.8597
Epoch 120/300
891/891 [==============================] - 0s 440us/step - loss: 0.3313 - acc: 0.8653
Epoch 121/300
891/891 [==============================] - 0s 434us/step - loss: 0.3372 - acc: 0.8631
Epoch 122/300
891/891 [==============================] - 0s 436us/step - loss: 0.3351 - acc: 0.8664
Epoch 123/300
891/891 [==============================] - 0s 427us/step - loss: 0.3336 - acc: 0.8687
Epoch 124/300
891/891 [==============================] - 0s 494us/step - loss: 0.3475 - acc: 0.8608
Epoch 125/300
891/891 [==============================] - 0s 460us/step - loss: 0.3655 - acc: 0.8496
Epoch 126/300
891/891 [==============================] - 0s 445us/step - loss: 0.3315 - acc: 0.8631
Epoch 127/300
891/891 [==============================] - 0s 452us/step - loss: 0.3505 - acc: 0.8485
Epoch 128/300
891/891 [==============================] - 0s 472us/step - loss: 0.3415 - acc: 0.8676
Epoch 129/300
891/891 [==============================] - 0s 480us/step - loss: 0.3377 - acc: 0.8676
Epoch 130/300
891/891 [==============================] - 0s 456us/step - loss: 0.3396 - acc: 0.8709
Epoch 131/300
891/891 [==============================] - 0s 449us/step - loss: 0.3314 - acc: 0.8664
Epoch 132/300
891/891 [==============================] - 0s 501us/step - loss: 0.3402 - acc: 0.8676
Epoch 133/300
891/891 [==============================] - 0s 456us/step - loss: 0.3510 - acc: 0.8642
Epoch 134/300
891/891 [==============================] - 0s 441us/step - loss: 0.3251 - acc: 0.8687
Epoch 135/300
891/891 [==============================] - 0s 457us/step - loss: 0.3336 - acc: 0.8709
Epoch 136/300
891/891 [==============================] - 0s 447us/step - loss: 0.3341 - acc: 0.8698
Epoch 137/300
891/891 [==============================] - 0s 489us/step - loss: 0.3486 - acc: 0.8676
Epoch 138/300
891/891 [==============================] - 0s 469us/step - loss: 0.3343 - acc: 0.8676
Epoch 139/300
891/891 [==============================] - 0s 446us/step - loss: 0.3579 - acc: 0.8519
Epoch 140/300
891/891 [==============================] - 0s 450us/step - loss: 0.3465 - acc: 0.8597
Epoch 141/300
891/891 [==============================] - 0s 441us/step - loss: 0.3474 - acc: 0.8597
Epoch 142/300
891/891 [==============================] - 0s 442us/step - loss: 0.3450 - acc: 0.8620
Epoch 143/300
891/891 [==============================] - 0s 434us/step - loss: 0.3365 - acc: 0.8642
Epoch 144/300
891/891 [==============================] - 0s 443us/step - loss: 0.3432 - acc: 0.8541
Epoch 145/300
891/891 [==============================] - 0s 431us/step - loss: 0.3443 - acc: 0.8608
Epoch 146/300
891/891 [==============================] - 0s 432us/step - loss: 0.3475 - acc: 0.8608
Epoch 147/300
891/891 [==============================] - 0s 440us/step - loss: 0.3450 - acc: 0.8496
Epoch 148/300
891/891 [==============================] - 0s 434us/step - loss: 0.3211 - acc: 0.8754
Epoch 149/300
891/891 [==============================] - 0s 442us/step - loss: 0.3265 - acc: 0.8631
Epoch 150/300
891/891 [==============================] - 0s 444us/step - loss: 0.3364 - acc: 0.8676
Epoch 151/300
891/891 [==============================] - 0s 434us/step - loss: 0.3282 - acc: 0.8709
Epoch 152/300
891/891 [==============================] - 0s 442us/step - loss: 0.3392 - acc: 0.8608
Epoch 153/300
891/891 [==============================] - 0s 508us/step - loss: 0.3366 - acc: 0.8664
Epoch 154/300
891/891 [==============================] - 0s 475us/step - loss: 0.3372 - acc: 0.8664
Epoch 155/300
891/891 [==============================] - 0s 460us/step - loss: 0.3360 - acc: 0.8642
Epoch 156/300
891/891 [==============================] - 0s 437us/step - loss: 0.3407 - acc: 0.8620
Epoch 157/300
891/891 [==============================] - 0s 478us/step - loss: 0.3259 - acc: 0.8597
Epoch 158/300
891/891 [==============================] - 0s 485us/step - loss: 0.3415 - acc: 0.8586
Epoch 159/300
891/891 [==============================] - 0s 477us/step - loss: 0.3234 - acc: 0.8777
Epoch 160/300
891/891 [==============================] - 0s 444us/step - loss: 0.3458 - acc: 0.8653
Epoch 161/300
891/891 [==============================] - 0s 458us/step - loss: 0.3378 - acc: 0.8664
Epoch 162/300
891/891 [==============================] - 0s 459us/step - loss: 0.3352 - acc: 0.8687
Epoch 163/300
891/891 [==============================] - 0s 436us/step - loss: 0.3363 - acc: 0.8563
Epoch 164/300
891/891 [==============================] - 0s 476us/step - loss: 0.3364 - acc: 0.8721
Epoch 165/300
891/891 [==============================] - 0s 471us/step - loss: 0.3443 - acc: 0.8597
Epoch 166/300
891/891 [==============================] - 0s 448us/step - loss: 0.3240 - acc: 0.8721
Epoch 167/300
891/891 [==============================] - 0s 462us/step - loss: 0.3314 - acc: 0.8608
Epoch 168/300
891/891 [==============================] - 0s 456us/step - loss: 0.3423 - acc: 0.8586
Epoch 169/300
891/891 [==============================] - 0s 465us/step - loss: 0.3447 - acc: 0.8597
Epoch 170/300
891/891 [==============================] - 0s 458us/step - loss: 0.3500 - acc: 0.8698
Epoch 171/300
891/891 [==============================] - 0s 464us/step - loss: 0.3368 - acc: 0.8530
Epoch 172/300
891/891 [==============================] - 0s 419us/step - loss: 0.3378 - acc: 0.8563
Epoch 173/300
891/891 [==============================] - 0s 455us/step - loss: 0.3408 - acc: 0.8631
Epoch 174/300
891/891 [==============================] - 0s 429us/step - loss: 0.3328 - acc: 0.8676
Epoch 175/300
891/891 [==============================] - 0s 467us/step - loss: 0.3388 - acc: 0.8754
Epoch 176/300
891/891 [==============================] - 0s 446us/step - loss: 0.3400 - acc: 0.8687
Epoch 177/300
891/891 [==============================] - 0s 433us/step - loss: 0.3329 - acc: 0.8642
Epoch 178/300
891/891 [==============================] - 0s 461us/step - loss: 0.3285 - acc: 0.8754
Epoch 179/300
891/891 [==============================] - 0s 465us/step - loss: 0.3381 - acc: 0.8620
Epoch 180/300
891/891 [==============================] - 0s 447us/step - loss: 0.3270 - acc: 0.8664
Epoch 181/300
891/891 [==============================] - 0s 433us/step - loss: 0.3294 - acc: 0.8687
Epoch 182/300
891/891 [==============================] - 0s 426us/step - loss: 0.3376 - acc: 0.8586
Epoch 183/300
891/891 [==============================] - 0s 423us/step - loss: 0.3236 - acc: 0.8664
Epoch 184/300
891/891 [==============================] - 0s 475us/step - loss: 0.3342 - acc: 0.8687
Epoch 185/300
891/891 [==============================] - 0s 433us/step - loss: 0.3374 - acc: 0.8687
Epoch 186/300
891/891 [==============================] - 0s 482us/step - loss: 0.3404 - acc: 0.8631
Epoch 187/300
891/891 [==============================] - 0s 459us/step - loss: 0.3302 - acc: 0.8642
Epoch 188/300
891/891 [==============================] - 0s 436us/step - loss: 0.3205 - acc: 0.8732
Epoch 189/300
891/891 [==============================] - 0s 469us/step - loss: 0.3344 - acc: 0.8642
Epoch 190/300
891/891 [==============================] - 0s 443us/step - loss: 0.3246 - acc: 0.8765
Epoch 191/300
891/891 [==============================] - 0s 457us/step - loss: 0.3321 - acc: 0.8597
Epoch 192/300
891/891 [==============================] - 0s 465us/step - loss: 0.3268 - acc: 0.8496
Epoch 193/300
891/891 [==============================] - 0s 463us/step - loss: 0.3245 - acc: 0.8687
Epoch 194/300
891/891 [==============================] - 0s 474us/step - loss: 0.3178 - acc: 0.8732
Epoch 195/300
891/891 [==============================] - 0s 459us/step - loss: 0.3221 - acc: 0.8721
Epoch 196/300
891/891 [==============================] - 0s 470us/step - loss: 0.3183 - acc: 0.8754
Epoch 197/300
891/891 [==============================] - 0s 438us/step - loss: 0.3198 - acc: 0.8732
Epoch 198/300
891/891 [==============================] - 0s 481us/step - loss: 0.3371 - acc: 0.8530
Epoch 199/300
891/891 [==============================] - 0s 472us/step - loss: 0.3303 - acc: 0.8687
Epoch 200/300
891/891 [==============================] - 0s 431us/step - loss: 0.3264 - acc: 0.8754
Epoch 201/300
891/891 [==============================] - 0s 485us/step - loss: 0.3396 - acc: 0.8586
Epoch 202/300
891/891 [==============================] - 0s 459us/step - loss: 0.3085 - acc: 0.8799
Epoch 203/300
891/891 [==============================] - 0s 448us/step - loss: 0.3243 - acc: 0.8597
Epoch 204/300
891/891 [==============================] - 0s 464us/step - loss: 0.3154 - acc: 0.8687
Epoch 205/300
891/891 [==============================] - 0s 478us/step - loss: 0.3088 - acc: 0.8743
Epoch 206/300
891/891 [==============================] - 0s 474us/step - loss: 0.3352 - acc: 0.8541
Epoch 207/300
891/891 [==============================] - 0s 430us/step - loss: 0.3234 - acc: 0.8732
Epoch 208/300
891/891 [==============================] - 0s 474us/step - loss: 0.3375 - acc: 0.8676
Epoch 209/300
891/891 [==============================] - 0s 459us/step - loss: 0.3294 - acc: 0.8552
Epoch 210/300
891/891 [==============================] - 0s 465us/step - loss: 0.3402 - acc: 0.8597
Epoch 211/300
891/891 [==============================] - 0s 460us/step - loss: 0.3208 - acc: 0.8709
Epoch 212/300
891/891 [==============================] - 0s 481us/step - loss: 0.3168 - acc: 0.8676
Epoch 213/300
891/891 [==============================] - 0s 483us/step - loss: 0.3257 - acc: 0.8620
Epoch 214/300
891/891 [==============================] - 0s 452us/step - loss: 0.3171 - acc: 0.8687
Epoch 215/300
891/891 [==============================] - 0s 484us/step - loss: 0.3194 - acc: 0.8664
Epoch 216/300
891/891 [==============================] - 0s 465us/step - loss: 0.3239 - acc: 0.8676
Epoch 217/300
891/891 [==============================] - 0s 441us/step - loss: 0.3311 - acc: 0.8642
Epoch 218/300
891/891 [==============================] - 0s 469us/step - loss: 0.3095 - acc: 0.8765
Epoch 219/300
891/891 [==============================] - 0s 438us/step - loss: 0.3136 - acc: 0.8721
Epoch 220/300
891/891 [==============================] - 0s 476us/step - loss: 0.3162 - acc: 0.8799
Epoch 221/300
891/891 [==============================] - 0s 434us/step - loss: 0.3337 - acc: 0.8552
Epoch 222/300
891/891 [==============================] - 0s 480us/step - loss: 0.3153 - acc: 0.8799
Epoch 223/300
891/891 [==============================] - 0s 469us/step - loss: 0.3255 - acc: 0.8721
Epoch 224/300
891/891 [==============================] - 0s 473us/step - loss: 0.3099 - acc: 0.8754
Epoch 225/300
891/891 [==============================] - 0s 473us/step - loss: 0.3230 - acc: 0.8732
Epoch 226/300
891/891 [==============================] - 0s 460us/step - loss: 0.3162 - acc: 0.8754
Epoch 227/300
891/891 [==============================] - 0s 460us/step - loss: 0.3282 - acc: 0.8664
Epoch 228/300
891/891 [==============================] - 0s 473us/step - loss: 0.3278 - acc: 0.8676
Epoch 229/300
891/891 [==============================] - 0s 435us/step - loss: 0.3270 - acc: 0.8732
Epoch 230/300
891/891 [==============================] - 0s 471us/step - loss: 0.3320 - acc: 0.8664
Epoch 231/300
891/891 [==============================] - 0s 473us/step - loss: 0.3233 - acc: 0.8642
Epoch 232/300
891/891 [==============================] - 0s 472us/step - loss: 0.3389 - acc: 0.8608
Epoch 233/300
891/891 [==============================] - 0s 433us/step - loss: 0.3121 - acc: 0.8822
Epoch 234/300
891/891 [==============================] - 0s 470us/step - loss: 0.3227 - acc: 0.8754
Epoch 235/300
891/891 [==============================] - 0s 487us/step - loss: 0.3332 - acc: 0.8620
Epoch 236/300
891/891 [==============================] - 0s 436us/step - loss: 0.3363 - acc: 0.8698
Epoch 237/300
891/891 [==============================] - 0s 473us/step - loss: 0.3169 - acc: 0.8687
Epoch 238/300
891/891 [==============================] - 0s 473us/step - loss: 0.3261 - acc: 0.8721
Epoch 239/300
891/891 [==============================] - 0s 464us/step - loss: 0.3182 - acc: 0.8709
Epoch 240/300
891/891 [==============================] - 0s 472us/step - loss: 0.3122 - acc: 0.8765
Epoch 241/300
891/891 [==============================] - 0s 462us/step - loss: 0.3290 - acc: 0.8597
Epoch 242/300
891/891 [==============================] - 0s 479us/step - loss: 0.3188 - acc: 0.8653
Epoch 243/300
891/891 [==============================] - 0s 465us/step - loss: 0.3368 - acc: 0.8664
Epoch 244/300
891/891 [==============================] - 0s 435us/step - loss: 0.3117 - acc: 0.8866
Epoch 245/300
891/891 [==============================] - 0s 435us/step - loss: 0.3180 - acc: 0.8743
Epoch 246/300
891/891 [==============================] - 0s 430us/step - loss: 0.3187 - acc: 0.8687
Epoch 247/300
891/891 [==============================] - 0s 425us/step - loss: 0.3135 - acc: 0.8765
Epoch 248/300
891/891 [==============================] - 0s 407us/step - loss: 0.3281 - acc: 0.8642
Epoch 249/300
891/891 [==============================] - 0s 411us/step - loss: 0.3199 - acc: 0.8732
Epoch 250/300
891/891 [==============================] - 0s 417us/step - loss: 0.3251 - acc: 0.8575
Epoch 251/300
891/891 [==============================] - 0s 408us/step - loss: 0.3311 - acc: 0.8620
Epoch 252/300
891/891 [==============================] - 0s 416us/step - loss: 0.3257 - acc: 0.8709
Epoch 253/300
891/891 [==============================] - 0s 425us/step - loss: 0.3301 - acc: 0.8631
Epoch 254/300
891/891 [==============================] - 0s 404us/step - loss: 0.3456 - acc: 0.8586
Epoch 255/300
891/891 [==============================] - 0s 418us/step - loss: 0.3187 - acc: 0.8698
Epoch 256/300
891/891 [==============================] - 0s 494us/step - loss: 0.3101 - acc: 0.8754
Epoch 257/300
891/891 [==============================] - 0s 462us/step - loss: 0.3315 - acc: 0.8575
Epoch 258/300
891/891 [==============================] - 0s 433us/step - loss: 0.3082 - acc: 0.8777
Epoch 259/300
891/891 [==============================] - 0s 459us/step - loss: 0.3153 - acc: 0.8664
Epoch 260/300
891/891 [==============================] - 0s 472us/step - loss: 0.3260 - acc: 0.8653
Epoch 261/300
891/891 [==============================] - 0s 428us/step - loss: 0.3165 - acc: 0.8698
Epoch 262/300
891/891 [==============================] - 0s 490us/step - loss: 0.3186 - acc: 0.8653
Epoch 263/300
891/891 [==============================] - 0s 434us/step - loss: 0.3210 - acc: 0.8687
Epoch 264/300
891/891 [==============================] - 0s 481us/step - loss: 0.3164 - acc: 0.8732
Epoch 265/300
891/891 [==============================] - 0s 441us/step - loss: 0.3193 - acc: 0.8631
Epoch 266/300
891/891 [==============================] - 0s 478us/step - loss: 0.3302 - acc: 0.8552
Epoch 267/300
891/891 [==============================] - 0s 462us/step - loss: 0.3163 - acc: 0.8765
Epoch 268/300
891/891 [==============================] - 0s 470us/step - loss: 0.3207 - acc: 0.8822
Epoch 269/300
891/891 [==============================] - 0s 460us/step - loss: 0.3256 - acc: 0.8687
Epoch 270/300
891/891 [==============================] - 0s 462us/step - loss: 0.3140 - acc: 0.8754
Epoch 271/300
891/891 [==============================] - 0s 430us/step - loss: 0.3178 - acc: 0.8754
Epoch 272/300
891/891 [==============================] - 0s 501us/step - loss: 0.3304 - acc: 0.8664
Epoch 273/300
891/891 [==============================] - 0s 463us/step - loss: 0.3251 - acc: 0.8777
Epoch 274/300
891/891 [==============================] - 0s 458us/step - loss: 0.3159 - acc: 0.8743
Epoch 275/300
891/891 [==============================] - 0s 470us/step - loss: 0.3095 - acc: 0.8810
Epoch 276/300
891/891 [==============================] - 0s 471us/step - loss: 0.3104 - acc: 0.8732
Epoch 277/300
891/891 [==============================] - 0s 490us/step - loss: 0.3298 - acc: 0.8698
Epoch 278/300
891/891 [==============================] - 0s 446us/step - loss: 0.3264 - acc: 0.8754
Epoch 279/300
891/891 [==============================] - 0s 487us/step - loss: 0.3139 - acc: 0.8799
Epoch 280/300
891/891 [==============================] - 0s 470us/step - loss: 0.3140 - acc: 0.8765
Epoch 281/300
891/891 [==============================] - 0s 485us/step - loss: 0.3164 - acc: 0.8743
Epoch 282/300
891/891 [==============================] - 0s 481us/step - loss: 0.3134 - acc: 0.8754
Epoch 283/300
891/891 [==============================] - 0s 433us/step - loss: 0.3225 - acc: 0.8777
Epoch 284/300
891/891 [==============================] - 0s 434us/step - loss: 0.3098 - acc: 0.8732
Epoch 285/300
891/891 [==============================] - 0s 431us/step - loss: 0.3222 - acc: 0.8698
Epoch 286/300
891/891 [==============================] - 0s 433us/step - loss: 0.3269 - acc: 0.8676
Epoch 287/300
891/891 [==============================] - 0s 443us/step - loss: 0.3188 - acc: 0.8664
Epoch 288/300
891/891 [==============================] - 0s 482us/step - loss: 0.3190 - acc: 0.8754
Epoch 289/300
891/891 [==============================] - 0s 472us/step - loss: 0.3009 - acc: 0.8777
Epoch 290/300
891/891 [==============================] - 0s 458us/step - loss: 0.3266 - acc: 0.8698
Epoch 291/300
891/891 [==============================] - 0s 459us/step - loss: 0.3266 - acc: 0.8721
Epoch 292/300
891/891 [==============================] - 0s 455us/step - loss: 0.3143 - acc: 0.8698
Epoch 293/300
891/891 [==============================] - 0s 475us/step - loss: 0.3299 - acc: 0.8653
Epoch 294/300
891/891 [==============================] - 0s 460us/step - loss: 0.3165 - acc: 0.8698
Epoch 295/300
891/891 [==============================] - 0s 482us/step - loss: 0.3148 - acc: 0.8765
Epoch 296/300
891/891 [==============================] - 0s 436us/step - loss: 0.3335 - acc: 0.8620
Epoch 297/300
891/891 [==============================] - 0s 482us/step - loss: 0.3139 - acc: 0.8732
Epoch 298/300
891/891 [==============================] - 0s 458us/step - loss: 0.3345 - acc: 0.8709
Epoch 299/300
891/891 [==============================] - 0s 458us/step - loss: 0.3225 - acc: 0.8687
Epoch 300/300
891/891 [==============================] - 0s 465us/step - loss: 0.3049 - acc: 0.8822
In [1519]:
# print(model.metrics_names)
plt.plot(hist.history['acc'], 'b-', label='acc' )
plt.plot(hist.history['loss'], 'r-', label='loss' )
plt.xlabel('epochs')
plt.legend()
plt.show()
In [ ]:
result = pred.argmax(axis=1)

Submission file:

In [1523]:
submission = pd.DataFrame({'PassengerId': test.index, 'Survived': result})
submission.to_csv('titanic/submission.csv', index=False)