Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
kaz-Anova authored Sep 8, 2017
1 parent 37bb8e3 commit e588447
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions example/zillow_regression_sparse/combine_subs_v2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 06 01:34:03 2017
@author: mimar
"""

base="output_dataset2_merged.csv" # stacknet preds
prediction="xxx.csv"#script preds
output="output_dataset2_merged_v2.csv"# file to generate submissions to

ff=open(base, "r")
ff_pred=open(prediction, "r")
fs=open(output,"w")
fs.write(ff.readline())
ff_pred.readline()

s=0
for line in ff:
splits=line.replace("\n","").split(",")
ids=splits[0]
preds=[]
for j in range (1,7):
preds.append(float(splits[j]))


pre_line_splits=ff_pred.readline().replace("\n","").split(",")
for j in range (1,7):
preds[j-1]=(preds[j-1]*0.6 + float(pre_line_splits[j])*0.4)

fs.write(ids)
for j in range(6):
fs.write( "," +str(preds[j] ))
fs.write("\n")
s+=1

ff.close()
ff_pred.close()
fs.close()

print ("done")

0 comments on commit e588447

Please sign in to comment.