本文整理匯總了Python中joblib.Parallel.to_pickle方法的典型用法代碼示例。如果您正苦於以下問題:Python Parallel.to_pickle方法的具體用法?Python Parallel.to_pickle怎麽用?Python Parallel.to_pickle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類joblib.Parallel
的用法示例。
在下文中一共展示了Parallel.to_pickle方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Attriters
# 需要導入模塊: from joblib import Parallel [as 別名]
# 或者: from joblib.Parallel import to_pickle [as 別名]
10. ABC Attriters (main sample)
11. ABC Post Attrition (main sample)
'''
for comparison in ['TC','AC'] :
if comparison == 'TC': # comparing treatment against control
data_pre = abccare.copy()
if comparison == 'AC': # comparing ABC against CARE (so R = 1 if CARE, now)
data_pre = abccare.copy()
data_pre.loc[:, 'R'] = 1 - data_pre.loc[:, 'abc']
for cohort in [0, 8]:
if cohort == 0:
data = data_pre
if cohort == 7:
data = data_pre.drop(crime_attrit, axis=0)
if cohort == 8:
data = data_pre.loc[data_pre.si34y_complete==1]
rslt = Parallel(n_jobs=1)(
delayed(diff_by_sex)(data, s, i) for i,s in samples.iterrows())
rslt = pd.concat(rslt, axis=0, keys=range(len(rslt)), names=['draw'])
if cohort == 0:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_{}.pkl'.format(comparison)))
if cohort == 7:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_crime_{}.pkl'.format(comparison)))
if cohort == 8:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_health_{}.pkl'.format(comparison)))
示例2: Parallel
# 需要導入模塊: from joblib import Parallel [as 別名]
# 或者: from joblib.Parallel import to_pickle [as 別名]
data = abccare
if cohort in [1,2,3,4]:
data = abccare.loc[abccare.cohort == cohort]
if cohort == 7:
data = abccare.drop(crime_attrit, axis=0)
if cohort == 8:
data = abccare.loc[abccare.si34y_complete==1]
if cohort == 10:
data = abccare.copy()
data.R= 0
data.loc[attriters, 'R'] = 1
if cohort == 11:
data = abccare.drop(attriters, axis=0)
rslt = Parallel(n_jobs=1)(
delayed(diff_by_sex)(data, s, i) for i,s in samples.iterrows())
rslt = pd.concat(rslt, axis=0, keys=range(len(rslt)), names=['draw'])
if cohort == 0:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance.pkl'))
if cohort in [1,2,3,4]:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_coh{}.pkl'.format(cohort)))
if cohort == 7:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_crime.pkl'))
if cohort == 8:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_health.pkl'))
if cohort == 10:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_attrition.pkl'))
if cohort == 11:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_postattrition.pkl'))
示例3: Parallel
# 需要導入模塊: from joblib import Parallel [as 別名]
# 或者: from joblib.Parallel import to_pickle [as 別名]
RV_s = 2
if RV == 1:
data_pre = abccare.copy()
data_pre.drop(data_pre.loc[(data_pre.R==1)].index, inplace=True)
data_pre.loc[:, 'R'] = data_pre.loc[:, 'RV']
RV_s = 1
for cohort in [0, 5, 6, 8]:
if cohort == 0:
data = data_pre
if cohort in [5,6]:
data = data_pre.loc[data_pre.cohort == cohort]
if cohort == 7:
data = data_pre.drop(crime_attrit, axis=0)
if cohort == 8:
data = data_pre.loc[data_pre.si34y_complete==1]
rslt = Parallel(n_jobs=1)(
delayed(diff_by_sex)(data, s, i) for i,s in samples.iterrows())
rslt = pd.concat(rslt, axis=0, keys=range(len(rslt)), names=['draw'])
if cohort == 0:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_{}.pkl'.format(RV_s)))
if cohort in [5,6]:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_coh{}_{}.pkl'.format(cohort, RV_s)))
if cohort == 7:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_crime_{}.pkl'.format(RV_s)))
if cohort == 8:
rslt.to_pickle(os.path.join(paths.rslt, 'bootstrap_balance_health_{}.pkl'.format(RV_s)))