Skip to content

Commit

Permalink
update with PyKEEN 1.8.1-dev0 (6ac40cd5)
Browse files Browse the repository at this point in the history
add geometric mean rank adjustments
  • Loading branch information
mberr committed Mar 29, 2022
1 parent d50af9c commit 18427ce
Show file tree
Hide file tree
Showing 15 changed files with 3,951 additions and 3,191 deletions.
Binary file modified charts/arithmetic_mean_rank_plot.pdf
Binary file not shown.
Binary file modified charts/arithmetic_mean_rank_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
816 changes: 402 additions & 414 deletions charts/arithmetic_mean_rank_plot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/hits_at_10_plot.pdf
Binary file not shown.
Binary file modified charts/hits_at_10_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
978 changes: 486 additions & 492 deletions charts/hits_at_10_plot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/mean_reciprocal_rank_plot.pdf
Binary file not shown.
Binary file modified charts/mean_reciprocal_rank_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
964 changes: 479 additions & 485 deletions charts/mean_reciprocal_rank_plot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/summary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4,279 changes: 2,505 additions & 1,774 deletions charts/summary.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 17 additions & 17 deletions collated/collated.tsv

Large diffs are not rendered by default.

40 changes: 36 additions & 4 deletions collated/melted.tsv

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions scripts/fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
continue
original_column = column[2:]
pairs[column] = original_column
pairs["z_geometric_mean_rank"] = "geometric_mean_rank"

hits_prefix = "hits_at_"
expectation, variance = {}, {}
Expand All @@ -35,14 +36,23 @@
kwargs = {}
norm_metric_name = metric_name
if hits_prefix in metric_name:
kwargs["k"] = int(metric_name[len(hits_prefix):])
kwargs["k"] = int(metric_name[len(hits_prefix) :])
norm_metric_name = hits_prefix
metric = rank_based_metric_resolver.make(norm_metric_name, pos_kwargs=kwargs)
mean = metric.expected_value(num_candidates=num_candidates)
std = metric.std(num_candidates=num_candidates)
df.loc[df["dataset"] == dataset_name, z_metric_name] = (
df.loc[df["dataset"] == dataset_name, metric_name] - mean
) / std
value = (df.loc[df["dataset"] == dataset_name, metric_name] - mean) / std
if "geometric_mean_rank" in metric_name:
value *= -1
df.loc[df["dataset"] == dataset_name, z_metric_name] = value
# adjusted geometric mean rank index
metric_name = "geometric_mean_rank"
metric = rank_based_metric_resolver.make(metric_name)
mean = metric.expected_value(num_candidates=num_candidates)
std = metric.std(num_candidates=num_candidates)
value = (df.loc[df["dataset"] == dataset_name, metric_name] - mean) / (1 - mean)
df.loc[df["dataset"] == dataset_name, "adjusted_geometric_mean_rank_index"] = value

df.to_csv("collated/collated.tsv", sep="\t", index=False)

id_vars = ["dataset", "dataset_triples", "model"]
Expand Down
13 changes: 12 additions & 1 deletion scripts/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ def _lookup_key(d):
],
"short": ["$H_{10}$", "$AH_{10}$", "$ZH_{10}$"],
},
"geometric_mean_rank": {
"base_title": "Geometric Mean Rank",
"base_yscale": "log",
"metrics": [
"geometric_mean_rank",
"adjusted_geometric_mean_rank_index",
"z_geometric_mean_rank",
],
"short": ["GMR", "AGMRI", "ZGMR"],
"has_negative_z": True,
}
}


Expand Down Expand Up @@ -115,7 +126,7 @@ def main():
else:
ax.set_yscale("log")
elif key.startswith("Adjusted Index"):
ax.set_ylim([0, 1])
ax.set_ylim([-0.1, 1])
else: # base metric
if "base_ylim" in metadata:
ax.set_ylim(metadata["base_ylim"])
Expand Down

0 comments on commit 18427ce

Please sign in to comment.