<jupyter_start><jupyter_text>**Resource:**https://www.kaggle.com/sinakhorami/titanic-best-working-classifier<jupyter_code>%matplotlib inline
import torch
import numpy as np
import pandas as pd
import re as re

train = pd.read_csv('./train.csv', header = 0, dtype={'Age': np.float64})
test  = pd.read_csv('./test.csv' , header = 0, dtype={'Age': np.float64})
full_data = [train, test]

print (train.info())
train.head()<jupyter_output><empty_output><jupyter_text>**Pclass**<jupyter_code>print (train[['Pclass', 'Survived']].groupby(['Pclass'], as_index=False).mean())<jupyter_output>Pclass  Survived
0       1  0.629630
1       2  0.472826
2       3  0.242363<jupyter_text>**Sex**<jupyter_code>print(train[['Sex', 'Survived']].groupby(['Sex'], as_index=False).mean())<jupyter_output>Sex  Survived
0  female  0.742038
1    male  0.188908<jupyter_text>**SibSp and Parch**<jupyter_code>for dataset in full_data:
    dataset['FamilySize'] = dataset['SibSp'] + dataset['Parch'] + 1
print (train[['FamilySize', 'Survived']].groupby(['FamilySize'], as_index=False).mean())<jupyter_output>FamilySize  Survived
0           1  0.303538
1           2  0.552795
2           3  0.578431
3           4  0.724138
4           5  0.200000
5           6  0.136364
6           7  0.333333
7           8  0.000000
8          11  0.000000<jupyter_text>Go by 4 pepole has high chance to survived<jupyter_code>train['Sex'].value_counts()<jupyter_output><empty_output><jupyter_text>`male` is more than `female` in number<jupyter_code>train['Embarked'].isnull().values.any()# Embarked has null value inside
# Common value is `S`. Then I am going to fill it with `S` like the reference
# for dataset in full_data:
#     dataset['Embarked'] = dataset['Embarked'].fillna('S')
train['Embarked'].value_counts()
# Strang I don't have any null value in `Fare`
train['Fare'].isnull().values.any()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15274841437632136, 'fraction_numerical': 0.07029598308668077, 'mean_word_length': 4.362606232294618, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '397776', 'license': 'MIT', 'n_tokens_mistral': 779, 'n_tokens_neox': 713, 'n_words': 149, 'path': 'titanic/exercise8_dataloader.ipynb', 'repo_name': 'elcolie/practice-pytorch', 'size': '1892'}