def get_score_funcs():
"""Helper to get the score functions"""
from scipy import stats
from scipy.spatial import distance
score_funcs = Bunch()
xy_arg_dist_funcs = [(n, f) for n, f in vars(distance).items()
if isfunction(f) and not n.startswith('_')]
xy_arg_stats_funcs = [(n, f) for n, f in vars(stats).items()
if isfunction(f) and not n.startswith('_')]
score_funcs.update(dict((n, _make_xy_sfunc(f))
for n, f in xy_arg_dist_funcs
if _get_args(f) == ['u', 'v']))
score_funcs.update(dict((n, _make_xy_sfunc(f, ndim_output=True))
for n, f in xy_arg_stats_funcs
if _get_args(f) == ['x', 'y']))
return score_funcs
评论列表
文章目录