Calmcode - scikit dummy: comparison


1 2 3 4

Compare DummyClassifier with GridSeach

Let's run a dummy model in a gridsearch so we can compare with our original result.

pipe = Pipeline([
    ('scale', StandardScaler()),
    ('model', DummyClassifier())

grid = GridSearchCV(estimator=pipe,
                    param_grid={'model__strategy': ['stratified', 'most_frequent', 'uniform']},
                    scoring={'acc': make_scorer(accuracy_score)},
                    return_train_score=True), y)

To see the gridsearch results you can run;

pd.DataFrame(grid.cv_results_)[['param_model__strategy', 'mean_test_acc']]

Different strategies yield different results and inspecting these usually tells you something about the problem you're trying to solve.