<jupyter_start><jupyter_text>**1. Generating reranked results from Answer (BERT-Q-a)"**<jupyter_code># define output path
output_path="../../../BERT-FAQ/data/FAQIR/rank_results"
# define rank_field, w_t parameters
rank_field="BERT-Q-a"; w_t=10;<jupyter_output><empty_output><jupyter_text>**query_type="user_query"; neg_type="hard"; loss_type='triplet'**<jupyter_code># define variables
query_type="user_query"; neg_type="hard"; loss_type='triplet'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:31:17 - Re-ranking the top-k results ...
2021-04-07 17:31:20 - Re-ranking the top-k results ...
2021-04-07 17:31:22 - Re-ranking the top-k results ...
2021-04-07 17:31:25 - Re-ranking the top-k results ...<jupyter_text>**query_type="user_query"; neg_type="simple"; loss_type='triplet'**<jupyter_code># define variables
query_type="user_query"; neg_type="simple"; loss_type='triplet'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:31:27 - Re-ranking the top-k results ...
2021-04-07 17:31:29 - Re-ranking the top-k results ...
2021-04-07 17:31:32 - Re-ranking the top-k results ...
2021-04-07 17:31:34 - Re-ranking the top-k results ...<jupyter_text>**query_type="faq"; neg_type="hard"; loss_type='triplet'**<jupyter_code># define variables
query_type="faq"; neg_type="hard"; loss_type='triplet'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:31:36 - Re-ranking the top-k results ...
2021-04-07 17:31:39 - Re-ranking the top-k results ...
2021-04-07 17:31:41 - Re-ranking the top-k results ...
2021-04-07 17:31:44 - Re-ranking the top-k results ...<jupyter_text>**query_type="faq"; neg_type="simple"; loss_type='triplet'**<jupyter_code># define variables
query_type="faq"; neg_type="simple"; loss_type='triplet'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:31:46 - Re-ranking the top-k results ...
2021-04-07 17:31:48 - Re-ranking the top-k results ...
2021-04-07 17:31:51 - Re-ranking the top-k results ...
2021-04-07 17:31:53 - Re-ranking the top-k results ...<jupyter_text>**query_type="user_query"; neg_type="hard"; loss_type='softmax'**<jupyter_code># define variables
query_type="user_query"; neg_type="hard"; loss_type='softmax'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:31:56 - Re-ranking the top-k results ...
2021-04-07 17:31:58 - Re-ranking the top-k results ...
2021-04-07 17:32:00 - Re-ranking the top-k results ...
2021-04-07 17:32:03 - Re-ranking the top-k results ...<jupyter_text>**query_type="user_query"; neg_type="simple"; loss_type='softmax'**<jupyter_code># define variables
query_type="user_query"; neg_type="simple"; loss_type='softmax'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:32:05 - Re-ranking the top-k results ...
2021-04-07 17:32:08 - Re-ranking the top-k results ...
2021-04-07 17:32:10 - Re-ranking the top-k results ...
2021-04-07 17:32:13 - Re-ranking the top-k results ...<jupyter_text>**query_type="faq"; neg_type="hard"; loss_type='softmax'**<jupyter_code># define variables
query_type="faq"; neg_type="hard"; loss_type='softmax'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:32:15 - Re-ranking the top-k results ...
2021-04-07 17:32:17 - Re-ranking the top-k results ...
2021-04-07 17:32:20 - Re-ranking the top-k results ...
2021-04-07 17:32:22 - Re-ranking the top-k results ...<jupyter_text>**query_type="faq"; neg_type="simple"; loss_type='softmax'**<jupyter_code># define variables
query_type="faq"; neg_type="simple"; loss_type='softmax'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:32:25 - Re-ranking the top-k results ...
2021-04-07 17:32:27 - Re-ranking the top-k results ...
2021-04-07 17:32:29 - Re-ranking the top-k results ...
2021-04-07 17:32:32 - Re-ranking the top-k results ...<jupyter_text>**2. Generating reranked results from Question (BERT-Q-q)"**<jupyter_code># define rank_field, w_t parameters
rank_field="BERT-Q-q"; w_t=10;<jupyter_output><empty_output><jupyter_text>**query_type="user_query"; neg_type="hard"; loss_type='triplet'**<jupyter_code># define variables
query_type="user_query"; neg_type="hard"; loss_type='triplet'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:32:34 - Re-ranking the top-k results ...
2021-04-07 17:32:37 - Re-ranking the top-k results ...
2021-04-07 17:32:39 - Re-ranking the top-k results ...
2021-04-07 17:32:41 - Re-ranking the top-k results ...<jupyter_text>**query_type="user_query"; neg_type="simple"; loss_type='triplet'**<jupyter_code># define variables
query_type="user_query"; neg_type="simple"; loss_type='triplet'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:32:44 - Re-ranking the top-k results ...
2021-04-07 17:32:46 - Re-ranking the top-k results ...
2021-04-07 17:32:48 - Re-ranking the top-k results ...
2021-04-07 17:32:51 - Re-ranking the top-k results ...<jupyter_text>**query_type="faq"; neg_type="hard"; loss_type='triplet'**<jupyter_code># define variables
query_type="faq"; neg_type="hard"; loss_type='triplet'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:32:53 - Re-ranking the top-k results ...
2021-04-07 17:32:56 - Re-ranking the top-k results ...
2021-04-07 17:32:58 - Re-ranking the top-k results ...
2021-04-07 17:33:00 - Re-ranking the top-k results ...<jupyter_text>**query_type="faq"; neg_type="simple"; loss_type='triplet'**<jupyter_code># define variables
query_type="faq"; neg_type="simple"; loss_type='triplet'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:33:03 - Re-ranking the top-k results ...
2021-04-07 17:33:05 - Re-ranking the top-k results ...
2021-04-07 17:33:08 - Re-ranking the top-k results ...
2021-04-07 17:33:10 - Re-ranking the top-k results ...<jupyter_text>**query_type="user_query"; neg_type="hard"; loss_type='softmax'**<jupyter_code># define variables
query_type="user_query"; neg_type="hard"; loss_type='softmax'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:33:12 - Re-ranking the top-k results ...
2021-04-07 17:33:15 - Re-ranking the top-k results ...
2021-04-07 17:33:17 - Re-ranking the top-k results ...
2021-04-07 17:33:20 - Re-ranking the top-k results ...<jupyter_text>**query_type="user_query"; neg_type="simple"; loss_type='softmax'**<jupyter_code># define variables
query_type="user_query"; neg_type="simple"; loss_type='softmax'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:33:22 - Re-ranking the top-k results ...
2021-04-07 17:33:25 - Re-ranking the top-k results ...
2021-04-07 17:33:27 - Re-ranking the top-k results ...
2021-04-07 17:33:29 - Re-ranking the top-k results ...<jupyter_text>**query_type="faq"; neg_type="hard"; loss_type='softmax'**<jupyter_code># define variables
query_type="faq"; neg_type="hard"; loss_type='softmax'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:33:32 - Re-ranking the top-k results ...
2021-04-07 17:33:34 - Re-ranking the top-k results ...
2021-04-07 17:33:36 - Re-ranking the top-k results ...
2021-04-07 17:33:39 - Re-ranking the top-k results ...<jupyter_text>**query_type="faq"; neg_type="simple"; loss_type='softmax'**<jupyter_code># define variables
query_type="faq"; neg_type="simple"; loss_type='softmax'
# create instance of ReRanker class
r = ReRanker(rank_field=rank_field, w_t=w_t)
reranked_output_path = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type
pred_output_path     = output_path + "/supervised/" + rank_field + "/" + loss_type + "/" + query_type + "/" + neg_type

# generate reranked results 
bert_query_by_question = load_from_json(pred_output_path + '/bert_query_by_question.json')
reranked_query_by_question = r.get_reranked_results(bert_query_by_question)
dump_to_json(reranked_query_by_question, reranked_output_path + '/reranked_query_by_question.json')

bert_query_by_answer = load_from_json(pred_output_path + '/bert_query_by_answer.json')
reranked_query_by_answer = r.get_reranked_results(bert_query_by_answer)
dump_to_json(reranked_query_by_answer, reranked_output_path + '/reranked_query_by_answer.json')

bert_query_by_question_answer = load_from_json(pred_output_path + '/bert_query_by_question_answer.json')
reranked_query_by_question_answer = r.get_reranked_results(bert_query_by_question_answer)
dump_to_json(reranked_query_by_question_answer, reranked_output_path + '/reranked_query_by_question_answer.json')

bert_query_by_question_answer_concat = load_from_json(pred_output_path + '/bert_query_by_question_answer_concat.json')
reranked_query_by_question_answer_concat = r.get_reranked_results(bert_query_by_question_answer_concat)
dump_to_json(reranked_query_by_question_answer_concat, reranked_output_path + '/reranked_query_by_question_answer_concat.json')<jupyter_output>2021-04-07 17:33:41 - Re-ranking the top-k results ...
2021-04-07 17:33:43 - Re-ranking the top-k results ...
2021-04-07 17:33:46 - Re-ranking the top-k results ...
2021-04-07 17:33:48 - Re-ranking the top-k results ...
{'fraction_non_alphanumeric': 0.10667726550079491, 'fraction_numerical': 0.028680445151033386, 'mean_word_length': 8.258463350014718, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '18', 'dir': 'jupyter-structured-clean-dedup', 'id': '391657', 'license': 'MIT', 'n_tokens_mistral': 11963, 'n_tokens_neox': 11349, 'n_words': 1436, 'path': 'notebook/FAQIR/08.Generating_Reranked_Results.ipynb', 'repo_name': 'ML-Recipes/BERT-FAQ', 'size': '31450'}