本文整理汇总了Python中joblib.Parallel.rank方法的典型用法代码示例。如果您正苦于以下问题:Python Parallel.rank方法的具体用法?Python Parallel.rank怎么用?Python Parallel.rank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类joblib.Parallel
的用法示例。
在下文中一共展示了Parallel.rank方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Parallel
# 需要导入模块: from joblib import Parallel [as 别名]
# 或者: from joblib.Parallel import rank [as 别名]
output = pd.concat([output_aic, output_bic], axis = 0)
return output
best_aic = {}
best_bic = {}
for spec in ['abccare', 'abc', 'care']:
selection = Parallel(n_jobs=1)(
delayed(model_select)(data, yvar, bank, spec) for yvar in outcomes.index)
selection = pd.concat(selection, axis=0)
selection.sort_index(inplace=True)
# estimate rankings by AIC and BIC
selection = selection.rank(axis=1).groupby(level=0).sum()
best = selection.idxmin(axis = 1)
model_list = list(itertools.chain.from_iterable([itertools.combinations(bank, 3)]))
best_aic["{}".format(spec)] = model_list[selection.idxmin(axis = 1)[0]]
best_bic["{}".format(spec)] = model_list[selection.idxmin(axis = 1)[1]]
print 'Best AIC:', ('R', 'male', 'abc') + best_aic['{}'.format(spec)]
print 'Best BIC:', ('R', 'male', 'abc') + best_bic['{}'.format(spec)]
record = open('best_controls.txt', 'wb')
record.write('ABCCARE Best AIC: {} \n\n'.format(' '.join(('R', 'male', 'abc') + best_aic['abccare'])))
record.write('ABCCARE Best BIC: {}'.format(' '.join(('R', 'male', 'abc') + best_bic['abccare'])))
record.write('ABC Best AIC: {} \n\n'.format(' '.join(('R', 'male') + best_aic['abc'])))
record.write('ABC Best BIC: {}'.format(' '.join(('R', 'male') + best_bic['abc'])))
record.write('CARE Best AIC: {} \n\n'.format(' '.join(('R', 'male') + best_aic['care'])))