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 csv | |
r = csv.reader(open('train.csv','r')) | |
r.next() | |
edges = set() | |
#commutative_graph = dict() | |
for edge in r: | |
edges.add((edge[0], edge[1])) | |
# commutative_graph.setdefault(edge[0], set()).add(edge[1]) |
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
#!/usr/bin/env python | |
import sys | |
import csv | |
def MeanAveragePrecision(valid_filename, attempt_filename, at=10): | |
at = int(at) | |
valid = dict() | |
for line in csv.DictReader(open(valid_filename,'r')): | |
valid.setdefault(line['source_node'],set()).update(line['destination_nodes'].split(" ")) |
NewerOlder