Wanted to do grid search for recall and specificity but could not find specificity as a valid scoring parameter. I went to the scoring parameters for sklearn and did not see it in the list of valid parameters. Is there a work around or something I am missing in the parameter list?
This is what I have so far:
# Just some random example model.
pipe_rf = make_pipeline(RandomForestClassifier(criterion='gini',
n_estimators=25,
max_features=2,
max_depth=3,
random_state=1))
# Just filled in some parameters.
param_grid = [{'randomforestclassifier__n_estimators': [1, 2, 5, 10, 25, 50, 100],
'randomforestclassifier__max_features': [1, 2, 5, 10, 25, 50, 100],
'randomforestclassifier__max_depth': [1, 2, 5, 10, 25, 50, 100]}]
##### Perform the grid search #####
# *** Want to include specificity as a scoring metric *** #
gs = GridSearchCV(estimator=pipe_rf,
param_grid=param_grid,
scoring='recall',
refit=True,
cv=10,
n_jobs=-1)