MCPcopy Create free account
hub / github.com/Felixgithub2017/MMCU / main

Function main

TestChatGPT.py:156–178  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

154 return preds
155
156def main(args):
157 subjects = sorted([f.split(".xlsx")[0] for f in os.listdir(os.path.join(args.data_dir, "test")) if ".xlsx" in f])
158 if not os.path.exists(args.save_dir):
159 os.mkdir(args.save_dir)
160
161 print("subjects:", subjects)
162 print("args", args)
163
164 for subject in subjects:
165 if subject != "医疗":
166 dev_df = pd.read_excel(os.path.join(args.data_dir, "dev", subject + ".xlsx"), header=0)[:args.ntrain]
167 test_df = pd.read_excel(os.path.join(args.data_dir, "test", subject + ".xlsx"), header=0)
168 preds = eval(args, subject, dev_df, test_df)
169 writelines_to_file(os.path.join(args.save_dir, subject), preds)
170
171 else:
172 dev_df = pd.read_excel(os.path.join(args.data_dir, "dev", subject + ".xlsx"), header=0)[:args.ntrain]
173 f = pd.ExcelFile(os.path.join(args.data_dir, "test", subject + ".xlsx"))
174 sheet_list = f.sheet_names
175 for sheet in sheet_list:
176 test_df = pd.read_excel(os.path.join(args.data_dir, "test", subject + ".xlsx"), header=0, sheet_name=sheet)
177 preds = eval(args, sheet, dev_df, test_df)
178 writelines_to_file(os.path.join(args.save_dir, sheet), preds)
179
180if __name__ == "__main__":
181 parser = argparse.ArgumentParser()

Callers 1

TestChatGPT.pyFile · 0.70

Calls 2

evalFunction · 0.70
writelines_to_fileFunction · 0.70

Tested by

no test coverage detected