Scikit-learn classifier with custom scorer dependent on a training feature
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Drifting Through My Dreams
--
Chapters
00:00 Scikit-Learn Classifier With Custom Scorer Dependent On A Training Feature
02:15 Accepted Answer Score 0
02:34 Thank you
--
Full question
https://stackoverflow.com/questions/4924...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #machinelearning #scikitlearn #classification #gridsearch
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Drifting Through My Dreams
--
Chapters
00:00 Scikit-Learn Classifier With Custom Scorer Dependent On A Training Feature
02:15 Accepted Answer Score 0
02:34 Thank you
--
Full question
https://stackoverflow.com/questions/4924...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #machinelearning #scikitlearn #classification #gridsearch
#avk47
ACCEPTED ANSWER
Score 0
You can do something like this (note you have given no real code so this is barebones)
X = [...]
y = [...]
def custom_scorer_function(y, y_pred, **kwargs):
a_feature = X[:,1]
# now have y, y_pred and the feature you want
custom_scorer = make_scorer(custom_scorer_function, greater_is_better=True)
...