本文整理匯總了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'])))