Skip to content

Instantly share code, notes, and snippets.

@alexeyev
Created November 14, 2015 12:33
Show Gist options
  • Save alexeyev/bdbc4140fb68f36fac63 to your computer and use it in GitHub Desktop.
Save alexeyev/bdbc4140fb68f36fac63 to your computer and use it in GitHub Desktop.
Dumb voting w/o correlation estimation
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