evals = logit.cdf(logit_odds) ev_value = [ curr_ver, ] ev_value.extend(ex01.evaluate_ex(next_df, evals)) ev_values.append(ev_value) prm_note.append(curr_ver) prm_note.append(best_prms) df = pd.DataFrame(ev_values) df.columns = ['version', 'nm', 'np', 'nf', 'nc', 'f_value'] df = df.sort_index(ascending=False) df.to_csv('./../result/ex12/record_ex12_' + mdl_typ + '_' + str(THRESHOLD) + '.csv', index=False, cols=None) df = pd.DataFrame(prm_note) df.to_csv('./../result/ex12/prm_note_' + mdl_typ + '.csv', index=False, cols=None) if __name__ == '__main__': # ex1(0.5) ex12_short('nml') ex12_short('rfn') ex12_short('chrn') fig.draw_graph(12)
# create model used evaluatopn_ex next_df = mmm.create_df(next_ver) # explanatory value ev_data = next_df[list(best_prms)] # operate evaluation_ex logit_odds = ev_data.dot(coef) evals = logit.cdf(logit_odds) ev_value = [curr_ver,] ev_value.extend( ex01.evaluate_ex(next_df, evals) ) ev_values.append(ev_value) prm_note.append(curr_ver) prm_note.append(best_prms) df = pd.DataFrame(ev_values) df.columns = ['version','nm','np','nf','nc','f_value'] df = df.sort_index(ascending=False) df.to_csv( './../result/ex12/record_ex12_' + mdl_typ + '_' + str(THRESHOLD) + '.csv', index=False, cols=None) df = pd.DataFrame(prm_note) df.to_csv( './../result/ex12/prm_note_'+mdl_typ+'.csv', index=False, cols=None) if __name__ == '__main__': # ex1(0.5) ex12_short('nml') ex12_short('rfn') ex12_short('chrn') fig.draw_graph(12)
logit_odds = ev_data.dot(coef) # print logit_odds evals = logit.cdf(logit_odds) # print evals ev_value = [ curr_ver, ] # ev_value.extend( ex01.evaluate_ex(next_df, evals, mdl_typ,curr_ver) ) ev_value.extend(ex01.evaluate_ex(next_df, evals)) ev_values.append(ev_value) df = pd.DataFrame(ev_values) df.columns = ['version', 'nm', 'np', 'nf', 'nc', 'f_value'] df = df.sort_index(ascending=False) df.to_csv('./../result/ex2/record_ex2_' + mdl_typ + '_' + str(THRESHOLD) + '.csv', index=False, cols=None) if __name__ == '__main__': # ex2_short('nml', 0.3) # ex2_short('rfn', 0.3) ex2_short('nml', 0.5) ex2_short('rfn', 0.5) ex2_short('chrn', 0.5) fig.draw_graph(2)
# create model used evaluatopn_ex ev_data = next_df[ref_prms] # normalize ev_data = ev_data.div(ev_data.sum(1), axis=0) # operate evaluation_ex logit_odds = ev_data.dot(coef) evals = logit.cdf(logit_odds) ev_value = [ curr_ver, ] ev_value.extend(ex01.evaluate_ex(next_df, evals)) ev_values_ref.append(ev_value) df = pd.DataFrame(ev_values_nml) df.columns = ['version', 'nm', 'np', 'nf', 'nc', 'f_value'] df.to_csv('./../result/ex3/record_ex3_nml_' + str(THRESHOLD) + '.csv', index=False, cols=None) df = pd.DataFrame(ev_values_ref) df.columns = ['version', 'nm', 'np', 'nf', 'nc', 'f_value'] df.to_csv('./../result/ex3/record_ex3_rfn_' + str(THRESHOLD) + '.csv', index=False, cols=None) if __name__ == '__main__': ex3(0.5) fig.draw_graph(3)
# create model used evaluatopn_ex next_df = mmm.create_df(next_ver) # explanatory value ev_data = next_df[list(best_prms)] # operate evaluation_ex logit_odds = ev_data.dot(coef) evals = logit.cdf(logit_odds) ev_value = [curr_ver,] ev_value.extend( ex01.evaluate_ex(next_df, evals) ) ev_values.append(ev_value) prm_note.append(curr_ver) prm_note.append(best_prms) df = pd.DataFrame(ev_values) df.columns = ['version','nm','np','nf','nc','f_value'] df = df.sort_index(ascending=False) df.to_csv( './../result/ex11/record_ex11_' + mdl_typ + '_' + str(THRESHOLD) + '.csv', index=False, cols=None) df = pd.DataFrame(prm_note) df.to_csv( './../result/ex11/prm_note_'+mdl_typ+'.csv', index=False, cols=None) if __name__ == '__main__': # ex1(0.5) ex11_short('nml') ex11_short('rfn') ex11_short('chrn') fig.draw_graph(11)
# get coefficients params = result.params.values coef = pd.Series(params, index=ref_prms) # create model used evaluatopn_ex ev_data = next_df[ref_prms] # normalize ev_data = ev_data.div(ev_data.sum(1),axis=0) # operate evaluation_ex logit_odds = ev_data.dot(coef) evals = logit.cdf(logit_odds) ev_value = [curr_ver,] ev_value.extend( ex01.evaluate_ex(next_df, evals) ) ev_values_ref.append(ev_value) df = pd.DataFrame(ev_values_nml) df.columns = ['version','nm','np','nf','nc','f_value'] df.to_csv( './../result/ex3/record_ex3_nml_' + str(THRESHOLD) +'.csv', index=False, cols=None) df = pd.DataFrame(ev_values_ref) df.columns = ['version','nm','np','nf','nc','f_value'] df.to_csv( './../result/ex3/record_ex3_rfn_' + str(THRESHOLD) +'.csv', index=False, cols=None) if __name__ == '__main__': ex3(0.5) fig.draw_graph(3)
evals = logit.cdf(logit_odds) ev_value = [ curr_ver, ] ev_value.extend(ex01.evaluate_ex(next_df, evals)) ev_values.append(ev_value) prm_note.append(curr_ver) prm_note.append(best_prms) df = pd.DataFrame(ev_values) df.columns = ['version', 'nm', 'np', 'nf', 'nc', 'f_value'] df = df.sort_index(ascending=False) df.to_csv('./../result/ex11/record_ex11_' + mdl_typ + '_' + str(THRESHOLD) + '.csv', index=False, cols=None) df = pd.DataFrame(prm_note) df.to_csv('./../result/ex11/prm_note_' + mdl_typ + '.csv', index=False, cols=None) if __name__ == '__main__': # ex1(0.5) ex11_short('nml') ex11_short('rfn') ex11_short('chrn') fig.draw_graph(11)
# create model used evaluatopn_ex next_df = mm.create_df(next_ver) # explanatory value ev_data = next_df[list(best_prms)] # operate evaluation_ex logit_odds = ev_data.dot(coef) evals = logit.cdf(logit_odds) ev_value = [ curr_ver, ] ev_value.extend(ex01.evaluate_ex(next_df, evals)) ev_values.append(ev_value) df = pd.DataFrame(ev_values) df.columns = ['version', 'nm', 'np', 'nf', 'nc', 'f_value'] df = df.sort_index(ascending=False) df.to_csv('./../result/ex4/record_ex4_' + mdl_typ + '_' + str(THRESHOLD) + '.csv', index=False, cols=None) if __name__ == '__main__': # ex1(0.5) ex4_short('nml') ex4_short('rfn') ex4_short('chrn') fig.draw_graph(4)
import ex01 import ex02 import draw_figure as fig ex01.ex1(0.5) fig.draw_graph(1) ex02.ex1(0.5) fig.draw_graph(2) fig.draw_grph(1.2,1,'rfn',2,'rfn')
# get coefficients params = result.params.values coef = pd.Series(params, index=best_prms) # print coef # create model used evaluatopn_ex next_df = mm.create_df(next_ver) # explanatory value ev_data = next_df[list(best_prms)] # operate evaluation_ex logit_odds = ev_data.dot(coef) evals = logit.cdf(logit_odds) ev_value = [curr_ver,] ev_value.extend( ex01.evaluate_ex(next_df, evals) ) ev_values.append(ev_value) df = pd.DataFrame(ev_values) df.columns = ['version','nm','np','nf','nc','f_value'] df = df.sort_index(ascending=False) df.to_csv( './../result/ex4/record_ex4_' + mdl_typ + '_' + str(THRESHOLD) + '.csv', index=False, cols=None) if __name__ == '__main__': # ex1(0.5) ex4_short('nml') ex4_short('rfn') ex4_short('chrn') fig.draw_graph(4)