import sys sys.path.append('../TOOLS') from CIKM_TOOLS import * data_folder = '../../data/' cnn = pd.read_csv(data_folder + 'result_cnn.csv') nn = pd.read_csv(data_folder + 'result_nn.csv') gbdt = pd.read_csv(data_folder + 'result_gbdt.csv') result_full = 0.8*cnn+ 0.1*gbdt + 0.1*nn nnpatch = pd.read_csv(data_folder + 'result_nnpatch.csv') gbdtpatch = pd.read_csv(data_folder + 'result_gbdtpatch.csv') result_patch = 0.8*nnpatch + 0.2*gbdtpatch result = pd.concat([result_full,result_patch]) result = result.sort_values(by = 'PIC_IND' , ascending = [1]) submit0 = pd.DataFrame({'PIC_IND':np.arange(1,2001)}) submit0 = pd.merge(submit0,result, how = 'left' , on = 'PIC_IND') submit0 = submit0.fillna(method = 'ffill') submit0 = submit0.sort_values(by = ['PIC_IND'],ascending = [1]) submit0['value'].to_csv(data_folder + 'submit.csv', header = False , index = False) #submit0['value'].to_csv('../submit_official/' + 'submit.csv', header = False , index = False) print(submit0.mean())
时间: 2024-03-29 14:38:47 浏览: 107
详解axios在node.js中的post使用
这段代码的作用是读取多个CSV文件(包括"cnn.csv"、 "nn.csv"、 "gbdt.csv"、 "nnpatch.csv"和"gbdtpatch.csv"),将它们的内容组合成一个新的数据框架"result_full"和"result_patch",并将它们合并成一个名为"result"的数据框架。然后,对"result"进行排序处理,并根据"result"的内容生成一个名为"submit0"的新的数据框架。最后,将"submit0"的"value"列导出为CSV文件,并打印出"submit0"的平均值。
阅读全文