Skip to content

How to evaluate metrics on many subsets with multiple models efficiently #1360

Answered by mberr
mortenterhart asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @mortenterhart ,

there is a parameter clear_on_finalize of RankBasedEvaluator that should allow you to evaluate these metrics more efficiently.

Below I provide a commented example that should be easy to adapt to your case.

import numpy

from pykeen.datasets import get_dataset
from pykeen.datasets.nations import NATIONS_TEST_PATH
from pykeen.evaluation import RankBasedEvaluator, RankBasedMetricResults
from pykeen.evaluation.rank_based_evaluator import _iter_ranks
from pykeen.pipeline import pipeline
from pykeen.triples import TriplesFactory

# note: replace this by loading your custom dataset & model; it's only here to be self-contained
dataset = get_dataset(dataset="nations")
result = p…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@mortenterhart
Comment options

Answer selected by mortenterhart
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants