Skip to content

Commit 08d4509

Browse files
committed
fix: cap generalizability FF M_hat_mkpi to 1
1 parent 4812e81 commit 08d4509

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lambench/metrics/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ def filter_generalizability_force_field_results(
8080

8181
if v is not None:
8282
if normalize:
83-
v = v / std
83+
v = np.min(
84+
[v / std, 1]
85+
) # cap the normalized value to 1, for models worese than a dummy baseline, use dummy baseline.
8486
filtered_metrics[k] = np.log(v) * weight
8587
# else the filtered_metrics will not have this key.
8688
# Metrics with weight != None should have a value,

tests/metrics/test_visualization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_aggregate_ood_results_for_one_model(
1515
aggregator = ResultsFetcher()
1616
result = aggregator.aggregate_ood_results_for_one_model(model=model)
1717
np.testing.assert_almost_equal(result["Small Molecules"], 0.19745455, decimal=5)
18-
np.testing.assert_almost_equal(result["Inorganic Materials"], 0.3179398, decimal=5)
18+
np.testing.assert_almost_equal(result["Inorganic Materials"], 0.283787, decimal=5)
1919
assert result["Catalysis"] is None
2020
with caplog.at_level(logging.WARNING):
2121
assert (

0 commit comments

Comments
 (0)