R notebook using data from Titanic: Machine Learning from Disaster · 424 views · 3y ago
Overview
The data has been split into two groups:
- training set (train.csv)
- test set (test.csv)
The training set should be used to build your machine learning models. For the training set, we provide the outcome (also known as the “ground truth”) for each passenger. Your model will be based on “features” like passengers’ gender and class. You can also use feature engineering to create new features.
The test set should be used to see how well your model performs on unseen data. For the test set, we do not provide the ground truth for each passenger. It is your job to predict these outcomes. For each passenger in the test set, use the model you trained to predict whether or not they survived the sinking of the Titanic.
We also include gender_submission.csv, a set of predictions that assume all and only female passengers survive, as an example of what a submission file should look like.
Data Dictionary
VariableDefinitionKey survival Survival 0 = No, 1 = Yes pclass Ticket class 1 = 1st, 2 = 2nd, 3 = 3rd sex Sex Age Age in years sibsp # of siblings / spouses aboard the Titanic parch # of parents / children aboard the Titanic ticket Ticket number fare Passenger fare cabin Cabin number embarked Port of Embarkation C = Cherbourg, Q = Queenstown, S = SouthamptonVariable Notes
pclass: A proxy for socio-economic status (SES)
1st = Upper
2nd = Middle
3rd = Lower
age: Age is fractional if less than 1. If the age is estimated, is it in the form of xx.5
sibsp: The dataset defines family relations in this way...
Sibling = brother, sister, stepbrother, stepsister
Spouse = husband, wife (mistresses and fiancés were ignored)
parch: The dataset defines family relations in this way...
Parent = mother, father
Child = daughter, son, stepdaughter, stepson
Some children travelled only with a nanny, therefore parch=0 for them.
1 | PassengerId | Survived |
2 | 892 | 0 |
3 | 893 | 1 |
4 | 894 | 0 |
5 | 895 | 0 |
6 | 896 | 1 |
7 | 897 | 0 |
8 | 898 | 1 |
9 | 899 | 0 |
10 | 900 | 1 |
11 | 901 | 0 |
12 | 902 | 0 |
13 | 903 | 0 |
14 | 904 | 1 |
15 | 905 | 0 |
16 | 906 | 1 |
17 | 907 | 1 |
18 | 908 | 0 |
19 | 909 | 0 |
20 | 910 | 0 |
21 | 911 | 1 |
22 | 912 | 0 |
23 | 913 | 1 |
24 | 914 | 1 |
25 | 915 | 1 |
26 | 916 | 1 |
27 | 917 | 0 |
28 | 918 | 1 |
29 | 919 | 0 |
30 | 920 | 0 |
31 | 921 | 0 |
32 | 922 | 0 |
33 | 923 | 0 |
34 | 924 | 1 |
35 | 925 | 0 |
36 | 926 | 0 |
37 | 927 | 0 |
38 | 928 | 1 |
39 | 929 | 0 |
40 | 930 | 0 |
41 | 931 | 0 |
42 | 932 | 0 |
43 | 933 | 0 |
44 | 934 | 0 |
45 | 935 | 1 |
46 | 936 | 1 |
47 | 937 | 0 |
48 | 938 | 0 |
49 | 939 | 0 |
50 | 940 | 1 |
51 | 941 | 1 |
52 | 942 | 0 |
53 | 943 | 0 |
54 | 944 | 1 |
55 | 945 | 1 |
56 | 946 | 0 |
57 | 947 | 0 |
58 | 948 | 0 |
59 | 949 | 0 |
60 | 950 | 0 |
61 | 951 | 1 |
62 | 952 | 0 |
63 | 953 | 0 |
64 | 954 | 0 |
65 | 955 | 1 |
66 | 956 | 1 |
67 | 957 | 1 |
68 | 958 | 1 |
69 | 959 | 0 |
70 | 960 | 0 |
71 | 961 | 1 |
72 | 962 | 1 |
73 | 963 | 0 |
74 | 964 | 1 |
75 | 965 | 0 |
76 | 966 | 1 |
77 | 967 | 0 |
78 | 968 | 0 |
79 | 969 | 1 |
80 | 970 | 0 |
81 | 971 | 1 |
82 | 972 | 0 |
83 | 973 | 0 |
84 | 974 | 0 |
85 | 975 | 0 |
86 | 976 | 0 |
87 | 977 | 0 |
88 | 978 | 1 |
89 | 979 | 1 |
90 | 980 | 1 |
91 | 981 | 1 |
92 | 982 | 1 |
93 | 983 | 0 |
94 | 984 | 1 |
95 | 985 | 0 |
96 | 986 | 0 |
97 | 987 | 0 |
98 | 988 | 1 |
99 | 989 | 0 |
100 | 990 | 1 |