ind, gain = argMax_XleftOvers(left, s, wd, wr, query) if gain < eps: # if the best gain is very small break s.append(left[ind]) # add to final rank s_id.append([left[ind]["id"], gain]) # add to final rank (take only id) urls.append(left[ind]["url_b"]) del left[ind] # remove from X\S if len(s) > num_Docs: # if we chose more than num_Docs break print ind, str(datetime.now()) querysRanks[query] = s_id # dict the ranks per query print query, str(datetime.now()) if 1: #write an html per query with ordered urls tot_suc = htmlwrite(query, s_id, urls) if 1: # submission format # get topics dict topic_path = "../../devset_topics.xml" topDict = dict_topics(topic_path) res_path = pathRankings + "csluRanking.txt" fout = open(res_path, "w") run_id = "cslu" itern = "0" for query in testQueries: # for test set q_ranks = querysRanks[query] q_id = topDict[query] for i, (docno, score) in enumerate(q_ranks): fout.write("{0} {1} {2} {3} {4:" ">.2f} {5}".format( q_id.ljust(7),
ind, gain = argMax_XleftOvers(left, s, wd, wr, query) if gain < eps: # if the best gain is very small break s.append(left[ind]) # add to final rank s_id.append([left[ind]["id"], gain]) # add to final rank (take only id) urls.append(left[ind]["url_b"]) del left[ind] # remove from X\S if len(s) > num_Docs: # if we chose more than num_Docs break print ind, str(datetime.now()) querysRanks[query] = s_id # dict the ranks per query print query, str(datetime.now()) if 1: #write an html per query with ordered urls tot_suc = htmlwrite(query, s_id, urls) if 1: # submission format # get topics dict topic_path = "../../devset_topics.xml" topDict = dict_topics(topic_path) res_path = pathRankings+"csluRanking.txt" fout = open(res_path, "w") run_id = "cslu" itern = "0" for query in testQueries: # for test set q_ranks = querysRanks[query] q_id = topDict[query] for i, (docno, score) in enumerate(q_ranks):
ind, gain = argMax_XleftOvers(left, s, wd, wr, query) #if gain < eps: # if the best gain is very small # break s.append(left[ind]) # add to final rank s_id.append([left[ind]["id"], gain]) # add to final rank (take only id) urls.append(left[ind]["url_b"]) del left[ind] # remove from X\S if len(s) > num_Docs: # if we chose more than num_Docs break print ind, str(datetime.now()) querysRanks[query] = s_id # dict the ranks per query print query, str(datetime.now()) if 1: #write an html per query with ordered urls ir_q, cov_q = htmlwrite(query, s_id, urls) irl.append(ir_q) cov.append(cov_q) print "total irrelevance rate: ", sum(irl)/len(irl) print "total coverage rate: ", sum(cov)/len(cov) if 1: # submission format # get topics dict topic_path = "../../devset_topics.xml" topDict = dict_topics(topic_path) res_path = pathRankings+"csluRanking.txt" fout = open(res_path, "w") run_id = "cslu" itern = "0"
ind, gain = argMax_XleftOvers(left, s, wd, wr, query) #if gain < eps: # if the best gain is very small # break s.append(left[ind]) # add to final rank s_id.append([left[ind]["id"], gain]) # add to final rank (take only id) urls.append(left[ind]["url_b"]) del left[ind] # remove from X\S if len(s) > num_Docs: # if we chose more than num_Docs break print ind, str(datetime.now()) querysRanks[query] = s_id # dict the ranks per query print query, str(datetime.now()) if 1: #write an html per query with ordered urls ir_q, cov_q = htmlwrite(query, s_id, urls) irl.append(ir_q) cov.append(cov_q) print "total irrelevance rate: ", sum(irl) / len(irl) print "total coverage rate: ", sum(cov) / len(cov) if 1: # submission format # get topics dict topic_path = "../../devset_topics.xml" topDict = dict_topics(topic_path) res_path = pathRankings + "csluRanking.txt" fout = open(res_path, "w") run_id = "cslu" itern = "0" for query in testQueries: # for test set q_ranks = querysRanks[query]