model-mining logo model-mining: compare

1 2 3 4
Notes

It's always fair to compare your mined model to a machine learning model.

Here's the model that we ran.

from sklearn.ensemble import RandomForestClassifier

grid_rf = GridSearchCV(RandomForestClassifier(),
                    cv=2,
                    param_grid={},
                    scoring={'accuracy': make_scorer(accuracy_score),
                            'precision': make_scorer(precision_score),
                            'recall': make_scorer(recall_score)},
                    refit='accuracy')

# Cast the sex-column to dummy variable.
X, y = (df
        .assign(sex=lambda d: d['sex']=='male')
        .drop(columns=['survived', 'name']), df['survived'])

pd.DataFrame(grid_rf.fit(X, y).cv_results_)[['mean_test_accuracy', 'mean_test_precision', 'mean_test_recall']]