def section_6_2_3(virtual_successes=1, disp=True): if disp: print("\nSection 6.2.3") df = pd.DataFrame(columns=['lifetime', 'evolutionary', 'log-uniform', 'from research', 'eq. wt. avg.']) overall = [] for method in ['conservative', 'aggressive']: datadict = {'lifetime': functions.lifetime_anchor(method, virtual_successes=virtual_successes), 'evolutionary': functions.evolutionary_anchor(method, virtual_successes=virtual_successes), 'log-uniform': functions.log_uniform(method), 'from research': functions.four_param_framework_comp(rel_imp_res_comp=5, ftp_cal_equiv=1 / 300, spend2036=method, virtual_successes=virtual_successes) } average = float(np.average([value for value in datadict.values()])) overall.append(average) datadict['eq. wt. avg.'] = average datadict = {k: float(v) for k, v in datadict.items()} datadict = {k: round_sig(v * 100, 2, type=str) + "%" for k, v in datadict.items()} row = pd.Series(data=datadict, name=method) df = df.append(row) if disp: print(df) overall = np.average(overall) if disp: print("\nAll things considered average:", round_sig(overall * 100, 2, type=str) + "%") return overall
def section6_3_1_helper_comp(ftp_cal_equiv, rel_imp_res_comp, biggest_spends_method, rowname, df): if biggest_spends_method == '50/50': left = 1 / 2 * (functions.four_param_framework_comp(ftp_cal_equiv=ftp_cal_equiv, rel_imp_res_comp=rel_imp_res_comp, spend2036='aggressive') + functions.four_param_framework_comp(ftp_cal_equiv=ftp_cal_equiv, rel_imp_res_comp=rel_imp_res_comp, spend2036='conservative')) right = 1 / 2 * (functions.four_param_framework_comp(ftp_cal_equiv=ftp_cal_equiv, rel_imp_res_comp=rel_imp_res_comp, spend2036='aggressive', virtual_successes=0.5) + functions.four_param_framework_comp(ftp_cal_equiv=ftp_cal_equiv, rel_imp_res_comp=rel_imp_res_comp, spend2036='conservative', virtual_successes=0.5)) else: left = functions.four_param_framework_comp(ftp_cal_equiv=ftp_cal_equiv, rel_imp_res_comp=rel_imp_res_comp, spend2036=biggest_spends_method) right = functions.four_param_framework_comp(ftp_cal_equiv=ftp_cal_equiv, rel_imp_res_comp=rel_imp_res_comp, spend2036=biggest_spends_method, virtual_successes=0.5) left = round_sig(left * 100, 2, type=str) + "%" right = round_sig(right * 100, 2, type=str) + "%" return df.append(pd.Series(name=rowname, data={'1 VS': left, '0.5 VS': right}))
def section6_2_comp_from_research_helper(biggest_spends_method): print("\nBiggest_spends_method:", biggest_spends_method) columns = [1, 5, 10] df = pd.DataFrame(columns=columns) for ftp_cal_equiv in [1 / 50, 1 / 100, 1 / 300, 1 / 1000, 1 / 3000]: dict_comprehension = {rel_imp_res_comp: functions.four_param_framework_comp(rel_imp_res_comp=rel_imp_res_comp, regime_start=1956, forecast_to=2036, spend2036=biggest_spends_method, ftp_cal_equiv=ftp_cal_equiv) for rel_imp_res_comp in columns} dict_comprehension = {k: round_sig(v * 100, 2, type=str) + "%" for k, v in dict_comprehension.items()} row_name = 'ftp_cal = ' + to_fraction_strings(ftp_cal_equiv) row = pd.Series(data=dict_comprehension, name=row_name) df = df.append(row) df.columns = ["X=" + str(x) for x in columns] # rename the columns print(df)
def section_6_3_1_virtual_succ(): print("\nSection 6.3.1, virtual successes") df = pd.DataFrame(columns=['1 VS', '0.5 VS']) g_exp = 4.3 / 100 rowname = "Researcher-year, low" g_act = 7 / 100 ftp_cal_equiv = 1 / 1000 df = section6_3_1_helper_research(g_act, ftp_cal_equiv, g_exp, rowname, df) rowname = "Researcher-year, middle" g_act = 11 / 100 ftp_cal_equiv = 1 / 300 df = section6_3_1_helper_research(g_act, ftp_cal_equiv, g_exp, rowname, df) rowname = "Researcher-year, high" g_act = 16 / 100 ftp_cal_equiv = 1 / 100 df = section6_3_1_helper_research(g_act, ftp_cal_equiv, g_exp, rowname, df) rowname = 'Computation, low' ftp_cal_equiv = 1 / 1000 rel_imp_res_comp = 10 biggest_spends_method = 'conservative' df = section6_3_1_helper_comp(ftp_cal_equiv, rel_imp_res_comp, biggest_spends_method, rowname, df) rowname = 'Computation, central' left = 0.5 * (functions.lifetime_anchor('conservative', virtual_successes=1) + functions.lifetime_anchor('aggressive', virtual_successes=1)) right = 0.5 * (functions.lifetime_anchor('conservative', virtual_successes=.5) + functions.lifetime_anchor('aggressive', virtual_successes=.5)) left = round_sig(left * 100, 2, type=str) + "%" right = round_sig(right * 100, 2, type=str) + "%" df = df.append(pd.Series(name=rowname, data={'1 VS': left, '0.5 VS': right})) rowname = 'Computation, high' ftp_cal_equiv = 1 / 300 rel_imp_res_comp = 1 biggest_spends_method = 'aggressive' df = section6_3_1_helper_comp(ftp_cal_equiv, rel_imp_res_comp, biggest_spends_method, rowname, df) rowname = 'Computation, central, bracketed weigh. avg.' left = section_6_2_3(virtual_successes=1, disp=False) right = section_6_2_3(virtual_successes=.5, disp=False) left = round_sig(left * 100, 2, type=str) + "%" right = round_sig(right * 100, 2, type=str) + "%" df = df.append(pd.Series(name=rowname, data={'1 VS': left, '0.5 VS': right})) rowname = 'Computation, high, bracketed weigh. avg.' left = 0.5 * (functions.four_param_framework_comp(rel_imp_res_comp=1, ftp_cal_equiv=1 / 300, spend2036='aggressive', virtual_successes=1) + functions.log_uniform('aggressive')) right = 0.5 * (functions.four_param_framework_comp(rel_imp_res_comp=1, ftp_cal_equiv=1 / 300, spend2036='aggressive', virtual_successes=.5) + functions.log_uniform('aggressive')) left = round_sig(left * 100, 2, type=str) + "%" right = round_sig(right * 100, 2, type=str) + "%" df = df.append(pd.Series(name=rowname, data={'1 VS': left, '0.5 VS': right})) print(df)
def computation_callable(year): return functions.four_param_framework_comp(forecast_to=year, **kwargs)