diff --git a/sbi/inference/posteriors/score_posterior.py b/sbi/inference/posteriors/score_posterior.py index e61a75129..73fd2088c 100644 --- a/sbi/inference/posteriors/score_posterior.py +++ b/sbi/inference/posteriors/score_posterior.py @@ -331,6 +331,9 @@ def map( Returns: The MAP estimate. """ + raise NotImplementedError( + "MAP estimation is currently not working accurately for ScorePosterior." + ) return super().map( x=x, num_iter=num_iter, diff --git a/sbi/inference/potentials/score_based_potential.py b/sbi/inference/potentials/score_based_potential.py index ae6d9eae3..f7be26c4c 100644 --- a/sbi/inference/potentials/score_based_potential.py +++ b/sbi/inference/potentials/score_based_potential.py @@ -160,6 +160,9 @@ def gradient( input=theta, condition=self.x_o, time=time ) else: + raise NotImplementedError( + "Score accumulation for IID data is not yet fully implemented." + ) if self.prior is None: raise ValueError( "Prior must be provided when interpreting the data as IID." diff --git a/tests/linearGaussian_npse_test.py b/tests/linearGaussian_npse_test.py index 855d5bb82..8d41dd5e9 100644 --- a/tests/linearGaussian_npse_test.py +++ b/tests/linearGaussian_npse_test.py @@ -1,3 +1,5 @@ +from typing import List + import pytest import torch from torch import eye, ones, zeros @@ -30,7 +32,7 @@ ], ) def test_c2st_npse_on_linearGaussian( - sde_type, num_dim: int, prior_str: str, sample_with: list[str] + sde_type, num_dim: int, prior_str: str, sample_with: List[str] ): """Test whether NPSE infers well a simple example with available ground truth.""" @@ -78,7 +80,7 @@ def test_c2st_npse_on_linearGaussian( check_c2st( samples, target_samples, - alg=f"npse-{sde_type or "vp"}-{prior_str}-{num_dim}D-{method}", + alg=f"npse-{sde_type or 'vp'}-{prior_str}-{num_dim}D-{method}", ) # Checks for log_prob() @@ -157,7 +159,12 @@ def simulator(theta): check_c2st(samples, target_samples, alg="npse_different_dims_and_resume_training") -@pytest.mark.xfail(reason="iid_bridge not working.") +@pytest.mark.xfail( + reason="iid_bridge not working.", + raises=NotImplementedError, + strict=True, + match="Score accumulation*", +) @pytest.mark.parametrize("num_trials", [2, 10]) def test_npse_iid_inference(num_trials): """Test whether NPSE infers well a simple example with available ground truth."""