Created
November 14, 2015 12:33
-
-
Save alexeyev/bdbc4140fb68f36fac63 to your computer and use it in GitHub Desktop.
Dumb voting w/o correlation estimation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import collections | |
import math | |
map = {i: [] for i in xrange(50000)} | |
for file in os.listdir("/home/alexeyev/projects/bee/"): | |
# files filter | |
if file.startswith("sol_0.7"): | |
print file | |
counter = 0 | |
for line in list(open("/home/alexeyev/projects/bee/" + file, "r+"))[1:]: | |
map[counter] = map[counter] + [math.floor(float(line.split(",")[1]))] | |
counter += 1 | |
with open("file_v_solution.csv", "wr+") as f: | |
f.write("ID,y\n") | |
for i in xrange(50000): | |
common, count = collections.Counter(map[i]).most_common()[0] | |
print i, ") count(", common, ") = ", count | |
f.write(str(i) + "," + str(common) + "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment