Hi. I wanted to report just Rouge-2-F, but I cannot find a way to do so. When I attach the RougeN metric, it is a single instance of ignite.metrics.Metric, but when printing it carries Rouge-2-P, Rouge-2-R, Rouge-2-F and a dictionary with the 3. From the dictionary I can get what I want, but want to drop the rest. How can I do it? Thanks in advance for any help you can provide.
Hi @AfonsoSalgadoSousa , you can use metric arithmetics to get “Rouge-2-F” only value:
from ignite.metrics import RougeN # We define the metric as # m = RougeN(ngram=2, multiref="best") # and apply getitem operator on resulting dictionary output: m = RougeN(ngram=2, multiref="best")["Rouge-2-F"] candidate = "the cat is not there".split() references = [ "the cat is on the mat".split(), "there is a cat on the mat".split() ] m.update(([candidate], [references])) print(m.compute()) > 0.4
More on metrics arithmetrics: