Last active
February 27, 2017 17:40
-
-
Save WittmannF/3649590161997c9372307a6f545f618c to your computer and use it in GitHub Desktop.
Example of code for achieving an accuracy higher than 83% at the P0 of MLND (adapted from the submission of one of the students)
This file contains 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
if passenger['Sex'] == 'male': | |
# male | |
if passenger['Age'] < 10: | |
if passenger['Pclass'] == 3: | |
if passenger['SibSp'] > 1: | |
predictions.append(0) | |
else: | |
predictions.append(1) | |
else: | |
predictions.append(1) | |
elif passenger['Age'] < 18: | |
if passenger['Pclass'] == 1: | |
predictions.append(1) | |
else: | |
predictions.append(0) | |
else: | |
predictions.append(0) | |
else: | |
# female | |
if passenger['Pclass'] == 3: | |
if passenger['Age'] > 20 and passenger['Age'] < 60: | |
predictions.append(0) | |
elif passenger['SibSp'] > 2: | |
predictions.append(0) | |
elif passenger['Parch'] > 3: | |
predictions.append(0) | |
else: | |
predictions.append(1) | |
else: | |
predictions.append(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment