Commit 9f880092 authored by Jerome Wuerf's avatar Jerome Wuerf
Browse files

Remove header from output

parent 37980b6b
......@@ -4,6 +4,7 @@
{
"name": "Python: Attach",
"type": "python",
"justMyCode": false,
"request": "attach",
"host": "localhost",
"port": 5678,
......
......@@ -15,32 +15,16 @@ services:
- /media:/media
- /tmp:/tmp
- /mnt/data/model:/model
depends_on:
- elastic
- /mnt:/mnt
entrypoint:
- "/bin/sh"
- -ecx
- |
python -m debugpy --wait-for-client --listen 0.0.0.0:5678 \
/app/src/app.py retrieval --topic-nrb 2 \
--reranking word-mover-distance --reuse-unranked /mnt/data/initial_retrieval_dump.pkl test \
/media/training-datasets/"touche-task-1"/touche-task-1-2022-02-16 /tmp/test
elastic:
image: "docker.elastic.co/elasticsearch/elasticsearch:7.15.2"
restart: always
networks:
- tira
ports:
- "9200:9200"
- "9300:9300"
volumes:
- /mnt/data/elastic:/usr/share/elasticsearch/data
- ./conifg:/conifg
environment:
- discovery.type=single-node
- logger.level=DEBUG
healthcheck:
test:
[
"CMD",
"curl",
"-s",
"-f",
"http://localhost:9200/_cat/health"
]
networks:
tira: null
......@@ -124,12 +124,15 @@ class Reranking:
stance_premise = premise['_source']['sentence_stance']
if stance_conclusion == stance_premise \
and premise['_id'] not in encountered_premise_ids:
final_key = "final_reranking_score" if "final_reranking_score" in conclusion else "_score"
trec_style_rows.append(
(topic_nrb, conclusion['_source']['sentence_stance'],
f'{"__".join(premise["_id"].split("_"))},' +
f'{"__".join(conclusion["_id"].split("_"))}',
len(trec_style_rows),
f'{conclusion["final_reranking_score"]:.2f}', self.run_name))
f'{conclusion[final_key]:.2f}', self.run_name))
encountered_premise_ids.add(premise['_id'])
break
rows_per_topic[topic_nrb] = trec_style_rows
......
......@@ -80,11 +80,11 @@ def parse_cli_args() -> argparse.Namespace:
parser_retrieval.add_argument('--lambda-conclusions',
type=float,
required=False,
default=0.5)
default=0.75)
parser_retrieval.add_argument('--lambda-premises',
type=float,
required=False,
default=0.5)
default=0.75)
parser_retrieval.add_argument('--wait-for-es',
action='store_true')
......
......@@ -10,7 +10,6 @@ def write_terc_file(result: list, output_path: Path) -> None:
with open(str(output_path), 'w') as csvfile:
fieldnames = ['qid', 'stance', 'pair', 'rank', 'score', 'tag']
writer = DictWriter(csvfile, delimiter=' ', fieldnames=fieldnames)
writer.writeheader()
for row in result:
writer.writerow(dict(zip(fieldnames, row)))
csvfile.flush()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment