def post(inx,k=3):
out = inx.replace('.csv','_sub.csv')
#if os.path.exists(out):
# return
fo = open(out,'w')
last = ''
pred = {}
for c,row in enumerate(csv.DictReader(open(inx))):
if last != '' and row['orderid'] != last:
pred = ','.join(sort_value(pred)[:3])
fo.write('%s,%s\n'%(last,pred))
pred = {}
yp = float(row['prob'])
pred[row['candidate_loc']] = yp
last = row['orderid']
if c % 10000000 == 0 and c>0:
print c#, 'log loss', score/(c+1), 'm12 apk', apks/dc
pred = ','.join(sort_value(pred)[:k])
fo.write('%s,%s\n'%(row['orderid'],pred))
fo.close()
评论列表
文章目录