Skip to content

Instantly share code, notes, and snippets.

@WittmannF
Last active February 27, 2017 17:40
Show Gist options
  • Save WittmannF/3649590161997c9372307a6f545f618c to your computer and use it in GitHub Desktop.
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)
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