Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
dilpath committed Jan 6, 2025
1 parent 1bdad80 commit 371ff20
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/analyze/test_analyze.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path

import numpy as np
import pytest

from petab_select import (
Expand Down Expand Up @@ -77,3 +78,17 @@ def test_relative_criterion_values(models: Models) -> None:
for criterion_value in criterion_values
]
assert test_value == expected_value


def test_compute_weights(models: Models) -> None:
"""Test ``analyze.compute_weights``."""
criterion_values = np.array(
models.get_criterion(criterion=Criterion.AIC, relative=True)
)
expected_weights = (
np.exp(-0.5 * criterion_values) / np.exp(-0.5 * criterion_values).sum()
)
test_weights = analyze.compute_weights(
models=models, criterion=Criterion.AIC
)
np.testing.assert_allclose(test_weights, expected_weights)

0 comments on commit 371ff20

Please sign in to comment.