Issue
I want to create a dictionary with string keys and some existing functions as corresponding values.
For example:
import numpy as np
my_useful_funtions_dicts = {'sum': np.sum, 'dot': np.dot}
This works great.
But I wanted to use a function from scikit learn and specifying a keyword argument.
For example using sklearn.metrics.roc_auc_score(*args, average='weighted')
I would like to run smtg like this :
from sklearn import metrics
my_dict = {'weighted_roc_auc': metrics.roc_auc_score(*args, average='weighted')}
Solution
my_dict = {'weighted_auc_roc_score': lambda true, pred: metrics.roc_auc_score(true, pred, average="weighted")}
Answered By - inarighas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.