def main(): from Model import model_creator import version_operator as vo # TODO arg value # ex01.ITER = 10 # ex01.PRED_TYPE = 'rf' model_dict = model_creator.get_model_dictionary() jobs = [] # model_dict = restrict_models(model_dict) for sw_name, models in model_dict.items(): print(sw_name) for model in models: ex01.TARGET = model.dir_name metrics_dir = '/Users/{}/Dropbox/STUDY/{}/Derby/all'\ .format(ENV, model.dir_name) ex01.METRICS_DIR = metrics_dir """ ここに実行する実験メソッドを書けば良い """ # vo.adjust_bug_list(model) job = Process(target=exp, args=(model, metrics_dir)) jobs.append(job) job.start() """ このインデントを維持する。 """ [jb.join() for jb in jobs]
def test_exp_model_set_param_dict(): from Model import model_creator models = [] model_dict = model_creator.get_model_dictionary() [models.extend(ms) for _, ms in model_dict.items()] for model in models: print(model.param_dictionary)
def main(): from Model import model_creator import version_operator as vo config_logger() model_dict = model_creator.get_model_dictionary() jobs = [] model_dict = retrieb_models(model_dict) for _, models in model_dict.items(): for model in models: # count_fp_nums(model) """ ここに実行する実験メソッドを書けば良い """ # vo.adjust_bug_list(model) # job = Process(target=exe_DIMA, args=(model,)) # job = Process(target=retrieb_bug_list, args=(model,)) # job = Process(target=merge_process_bug, args=(model,)) # job = Process(target=merge_process_bug_derby, args=(model,)) # job = Process(target=merge_process_product, args=(model,)) job = Process(target=execute_ex01, args=(model,)) # job = Process(target=execute_ex01_prob, args=(model,)) # job = Process(target=draw_metrics_distribution, args=(model,)) # job = Process(target=execute_grid_search, args=(model,)) # job = Process(target=count_fp_nums, args=(model,)) jobs.append(job) job.start() """ このインデントを維持する。 """ [jb.join() for jb in jobs]
def test_get_exp_versions(): from Model import model_creator model_dict = model_creator.get_model_dictionary() models = [] [models.extend(ms) for _, ms in model_dict.items()] print(str(len(models))) for model in models: print(model.sw_name, model.previous_version)
def create_all_models(): from Model import model_creator import version_operator as vo model_dict = model_creator.get_model_dictionary() jobs = [] # model_dict = retrieb_models(model_dict) all_models = [] for _, models in model_dict.items(): # models = retrieb_model_specified_versions(models) for model in models: all_models.append(model) return all_models
def _main(): from Model import model_creator import version_operator as vo import exp_execution as ex1 model_dict = model_creator.get_model_dictionary(exp_num=2) jobs = [] # model_dict = retrieb_models(model_dict) for _, models in model_dict.items(): # models = retrieb_model_specified_version(models) for model in models: """ ここに実行する実験メソッドを書けば良い """ print(model.sw_name, model.final_version, model.previous_version) ex1.execute_ex01(model)
def main(): import csv f = open('sw_indecies.csv', 'w') writer = csv.writer(f, lineterminator='\n') model_dict = model_creator.get_model_dictionary() indecies_list = [] col_list = ['total modules', 'modified modules', 'bug modules', 'modified bug modules'] writer.writerow(col_list) for sw_name, models in model_dict.items(): for model in models: print(sw_name, model.final_version) metrics_dir = "/Users/{}/Dropbox/STUDY/Metrics/".format(ENV) version = model.final_version metrics = Metrics_Origin(version, metrics_dir, model) modified_df, modified_fault = metrics.get_modified_df() df = pd.concat([modified_df, modified_fault], axis=1) modified_df = df.rename(columns = {df.columns[-1]:'fault'}) mrg_df, fault = metrics.mrg_df, metrics.fault df = pd.concat([mrg_df, fault], axis=1) df = df.rename(columns = {df.columns[-1]:'fault'}) # print(df) li = ['{} {}'.format(sw_name, model.final_version)] # 総モジュール数 print('total modules, {}'.format(len(df))) li.append(len(df)) # 変更モジュール数 print('modified modules, {}'.format(len(modified_df))) li.append(len(modified_df)) # 総欠陥数 d = df[fault.apply(lambda x: x==1)] print('bug modules, {}'.format(len(d))) li.append(len(d)) # 変更が合ったうちの総欠陥数 d = modified_df[fault.apply(lambda x: x==1)] print('modified bug modules, {}'.format(len(d))) li.append(len(d)) writer.writerow(li)