We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
custom distance function not passed to ABC inference
On trying to pass a custom function to define the distance metric for ABC methods (eg MCABC), the following error is received on running the inference model:

``` ```

Upon inspecting the source code at sbi/inference/abc/abc_base.py, I see that while there's code written to handle the custom function, the code is structured in a way to never reach it (it already assumes that the 'distance' parameter is a string, and only assigns the function to self.distance if distance is a String and not a callable.

![image](https://user-images.githubusercontent.com/98268983/215433044-d57c10c0-8a9a-4c81-84bc-8a3b8e3ec067.png)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `sbi/inference/abc/abc_base.py`
Content:
```
1 import logging
2 from abc import ABC
3 from typing import Callable, Union
4 
5 import numpy as np
6 import torch
7 from sklearn.linear_model import LinearRegression
8 from sklearn.preprocessing import PolynomialFeatures
9 from torch import Tensor
10 
11 from sbi.simulators.simutils import simulate_in_batches
12 
13 
14 class ABCBASE(ABC):
15     def __init__(
16         self,
17         simulator: Callable,
18         prior,
19         distance: Union[str, Callable] = "l2",
20         num_workers: int = 1,
21         simulation_batch_size: int = 1,
22         show_progress_bars: bool = True,
23     ) -> None:
24         r"""Base class for Approximate Bayesian Computation methods.
25 
26         Args:
27             simulator: A function that takes parameters $\theta$ and maps them to
28                 simulations, or observations, `x`, $\mathrm{sim}(\theta)\to x$. Any
29                 regular Python callable (i.e. function or class with `__call__` method)
30                 can be used.
31             prior: A probability distribution that expresses prior knowledge about the
32                 parameters, e.g. which ranges are meaningful for them. Any
33                 object with `.log_prob()`and `.sample()` (for example, a PyTorch
34                 distribution) can be used.
35             distance: Distance function to compare observed and simulated data. Can be
36                 a custom function or one of `l1`, `l2`, `mse`.
37             num_workers: Number of parallel workers to use for simulations.
38             simulation_batch_size: Number of parameter sets that the simulator
39                 maps to data x at once. If None, we simulate all parameter sets at the
40                 same time. If >= 1, the simulator has to process data of shape
41                 (simulation_batch_size, parameter_dimension).
42             show_progress_bars: Whether to show a progressbar during simulation and
43                 sampling.
44         """
45 
46         self.prior = prior
47         self._simulator = simulator
48         self._show_progress_bars = show_progress_bars
49 
50         # Select distance function.
51         if type(distance) == str:
52             distances = ["l1", "l2", "mse"]
53             assert (
54                 distance in distances
55             ), f"Distance function str must be one of {distances}."
56             self.distance = self.choose_distance_function(distance_type=distance)
57 
58         self._batched_simulator = lambda theta: simulate_in_batches(
59             simulator=self._simulator,
60             theta=theta,
61             sim_batch_size=simulation_batch_size,
62             num_workers=num_workers,
63             show_progress_bars=self._show_progress_bars,
64         )
65 
66         self.logger = logging.getLogger(__name__)
67 
68     @staticmethod
69     def choose_distance_function(distance_type: str = "l2") -> Callable:
70         """Return distance function for given distance type."""
71 
72         if distance_type == "mse":
73             distance = lambda xo, x: torch.mean((xo - x) ** 2, dim=-1)
74         elif distance_type == "l2":
75             distance = lambda xo, x: torch.norm((xo - x), dim=-1)
76         elif distance_type == "l1":
77             distance = lambda xo, x: torch.mean(abs(xo - x), dim=-1)
78         else:
79             raise ValueError(r"Distance {distance_type} not supported.")
80 
81         def distance_fun(observed_data: Tensor, simulated_data: Tensor) -> Tensor:
82             """Return distance over batch dimension.
83 
84             Args:
85                 observed_data: Observed data, could be 1D.
86                 simulated_data: Batch of simulated data, has batch dimension.
87 
88             Returns:
89                 Torch tensor with batch of distances.
90             """
91             assert simulated_data.ndim == 2, "simulated data needs batch dimension"
92 
93             return distance(observed_data, simulated_data)
94 
95         return distance_fun
96 
97     @staticmethod
98     def get_sass_transform(
99         theta: torch.Tensor,
100         x: torch.Tensor,
101         expansion_degree: int = 1,
102         sample_weight=None,
103     ) -> Callable:
104         """Return semi-automatic summary statitics function.
105 
106         Running weighted linear regressin as in
107         Fearnhead & Prandle 2012: https://arxiv.org/abs/1004.1112
108 
109         Following implementation in
110         https://abcpy.readthedocs.io/en/latest/_modules/abcpy/statistics.html#Identity
111         and
112         https://pythonhosted.org/abcpy/_modules/abcpy/summaryselections.html#Semiautomatic
113         """
114         expansion = PolynomialFeatures(degree=expansion_degree, include_bias=False)
115         # Transform x, remove intercept.
116         x_expanded = expansion.fit_transform(x)
117         sumstats_map = np.zeros((x_expanded.shape[1], theta.shape[1]))
118 
119         for parameter_idx in range(theta.shape[1]):
120             regression_model = LinearRegression(fit_intercept=True)
121             regression_model.fit(
122                 X=x_expanded, y=theta[:, parameter_idx], sample_weight=sample_weight
123             )
124             sumstats_map[:, parameter_idx] = regression_model.coef_
125 
126         sumstats_map = torch.tensor(sumstats_map, dtype=torch.float32)
127 
128         def sumstats_transform(x):
129             x_expanded = torch.tensor(expansion.fit_transform(x), dtype=torch.float32)
130             return x_expanded.mm(sumstats_map)
131 
132         return sumstats_transform
133 
134     @staticmethod
135     def run_lra(
136         theta: torch.Tensor,
137         x: torch.Tensor,
138         observation: torch.Tensor,
139         sample_weight=None,
140     ) -> torch.Tensor:
141         """Return parameters adjusted with linear regression adjustment.
142 
143         Implementation as in Beaumont et al. 2002: https://arxiv.org/abs/1707.01254
144         """
145 
146         theta_adjusted = theta
147         for parameter_idx in range(theta.shape[1]):
148             regression_model = LinearRegression(fit_intercept=True)
149             regression_model.fit(
150                 X=x,
151                 y=theta[:, parameter_idx],
152                 sample_weight=sample_weight,
153             )
154             theta_adjusted[:, parameter_idx] += regression_model.predict(
155                 observation.reshape(1, -1)
156             )
157             theta_adjusted[:, parameter_idx] -= regression_model.predict(x)
158 
159         return theta_adjusted
160
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/sbi/inference/abc/abc_base.py b/sbi/inference/abc/abc_base.py
--- a/sbi/inference/abc/abc_base.py
+++ b/sbi/inference/abc/abc_base.py
@@ -33,7 +33,7 @@
                 object with `.log_prob()`and `.sample()` (for example, a PyTorch
                 distribution) can be used.
             distance: Distance function to compare observed and simulated data. Can be
-                a custom function or one of `l1`, `l2`, `mse`.
+                a custom callable function or one of `l1`, `l2`, `mse`.
             num_workers: Number of parallel workers to use for simulations.
             simulation_batch_size: Number of parameter sets that the simulator
                 maps to data x at once. If None, we simulate all parameter sets at the
@@ -48,12 +48,7 @@
         self._show_progress_bars = show_progress_bars
 
         # Select distance function.
-        if type(distance) == str:
-            distances = ["l1", "l2", "mse"]
-            assert (
-                distance in distances
-            ), f"Distance function str must be one of {distances}."
-            self.distance = self.choose_distance_function(distance_type=distance)
+        self.distance = self.get_distance_function(distance)
 
         self._batched_simulator = lambda theta: simulate_in_batches(
             simulator=self._simulator,
@@ -66,8 +61,26 @@
         self.logger = logging.getLogger(__name__)
 
     @staticmethod
-    def choose_distance_function(distance_type: str = "l2") -> Callable:
-        """Return distance function for given distance type."""
+    def get_distance_function(distance_type: Union[str, Callable] = "l2") -> Callable:
+        """Return distance function for given distance type.
+
+        Args:
+            distance_type: string indicating the distance type, e.g., 'l2', 'l1',
+                'mse'. Note that the returned distance function averages over the last
+                dimension, e.g., over the summary statistics.
+
+        Returns:
+            distance_fun: distance functions built from passe string. Returns
+                distance_type is callable.
+        """
+
+        if isinstance(distance_type, Callable):
+            return distance_type
+
+        distances = ["l1", "l2", "mse"]
+        assert (
+            distance_type in distances
+        ), f"{distance_type} must be one of {distances}."
 
         if distance_type == "mse":
             distance = lambda xo, x: torch.mean((xo - x) ** 2, dim=-1)

{"golden_diff": "diff --git a/sbi/inference/abc/abc_base.py b/sbi/inference/abc/abc_base.py\n--- a/sbi/inference/abc/abc_base.py\n+++ b/sbi/inference/abc/abc_base.py\n@@ -33,7 +33,7 @@\n                 object with `.log_prob()`and `.sample()` (for example, a PyTorch\n                 distribution) can be used.\n             distance: Distance function to compare observed and simulated data. Can be\n-                a custom function or one of `l1`, `l2`, `mse`.\n+                a custom callable function or one of `l1`, `l2`, `mse`.\n             num_workers: Number of parallel workers to use for simulations.\n             simulation_batch_size: Number of parameter sets that the simulator\n                 maps to data x at once. If None, we simulate all parameter sets at the\n@@ -48,12 +48,7 @@\n         self._show_progress_bars = show_progress_bars\n \n         # Select distance function.\n-        if type(distance) == str:\n-            distances = [\"l1\", \"l2\", \"mse\"]\n-            assert (\n-                distance in distances\n-            ), f\"Distance function str must be one of {distances}.\"\n-            self.distance = self.choose_distance_function(distance_type=distance)\n+        self.distance = self.get_distance_function(distance)\n \n         self._batched_simulator = lambda theta: simulate_in_batches(\n             simulator=self._simulator,\n@@ -66,8 +61,26 @@\n         self.logger = logging.getLogger(__name__)\n \n     @staticmethod\n-    def choose_distance_function(distance_type: str = \"l2\") -> Callable:\n-        \"\"\"Return distance function for given distance type.\"\"\"\n+    def get_distance_function(distance_type: Union[str, Callable] = \"l2\") -> Callable:\n+        \"\"\"Return distance function for given distance type.\n+\n+        Args:\n+            distance_type: string indicating the distance type, e.g., 'l2', 'l1',\n+                'mse'. Note that the returned distance function averages over the last\n+                dimension, e.g., over the summary statistics.\n+\n+        Returns:\n+            distance_fun: distance functions built from passe string. Returns\n+                distance_type is callable.\n+        \"\"\"\n+\n+        if isinstance(distance_type, Callable):\n+            return distance_type\n+\n+        distances = [\"l1\", \"l2\", \"mse\"]\n+        assert (\n+            distance_type in distances\n+        ), f\"{distance_type} must be one of {distances}.\"\n \n         if distance_type == \"mse\":\n             distance = lambda xo, x: torch.mean((xo - x) ** 2, dim=-1)\n", "issue": "custom distance function not passed to ABC inference\nOn trying to pass a custom function to define the distance metric for ABC methods (eg MCABC), the following error is received on running the inference model:\r\n\r\n``` ```\r\n\r\nUpon inspecting the source code at sbi/inference/abc/abc_base.py, I see that while there's code written to handle the custom function, the code is structured in a way to never reach it (it already assumes that the 'distance' parameter is a string, and only assigns the function to self.distance if distance is a String and not a callable.\r\n\r\n![image](https://user-images.githubusercontent.com/98268983/215433044-d57c10c0-8a9a-4c81-84bc-8a3b8e3ec067.png)\r\n\n", "before_files": [{"content": "import logging\nfrom abc import ABC\nfrom typing import Callable, Union\n\nimport numpy as np\nimport torch\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.preprocessing import PolynomialFeatures\nfrom torch import Tensor\n\nfrom sbi.simulators.simutils import simulate_in_batches\n\n\nclass ABCBASE(ABC):\n    def __init__(\n        self,\n        simulator: Callable,\n        prior,\n        distance: Union[str, Callable] = \"l2\",\n        num_workers: int = 1,\n        simulation_batch_size: int = 1,\n        show_progress_bars: bool = True,\n    ) -> None:\n        r\"\"\"Base class for Approximate Bayesian Computation methods.\n\n        Args:\n            simulator: A function that takes parameters $\\theta$ and maps them to\n                simulations, or observations, `x`, $\\mathrm{sim}(\\theta)\\to x$. Any\n                regular Python callable (i.e. function or class with `__call__` method)\n                can be used.\n            prior: A probability distribution that expresses prior knowledge about the\n                parameters, e.g. which ranges are meaningful for them. Any\n                object with `.log_prob()`and `.sample()` (for example, a PyTorch\n                distribution) can be used.\n            distance: Distance function to compare observed and simulated data. Can be\n                a custom function or one of `l1`, `l2`, `mse`.\n            num_workers: Number of parallel workers to use for simulations.\n            simulation_batch_size: Number of parameter sets that the simulator\n                maps to data x at once. If None, we simulate all parameter sets at the\n                same time. If >= 1, the simulator has to process data of shape\n                (simulation_batch_size, parameter_dimension).\n            show_progress_bars: Whether to show a progressbar during simulation and\n                sampling.\n        \"\"\"\n\n        self.prior = prior\n        self._simulator = simulator\n        self._show_progress_bars = show_progress_bars\n\n        # Select distance function.\n        if type(distance) == str:\n            distances = [\"l1\", \"l2\", \"mse\"]\n            assert (\n                distance in distances\n            ), f\"Distance function str must be one of {distances}.\"\n            self.distance = self.choose_distance_function(distance_type=distance)\n\n        self._batched_simulator = lambda theta: simulate_in_batches(\n            simulator=self._simulator,\n            theta=theta,\n            sim_batch_size=simulation_batch_size,\n            num_workers=num_workers,\n            show_progress_bars=self._show_progress_bars,\n        )\n\n        self.logger = logging.getLogger(__name__)\n\n    @staticmethod\n    def choose_distance_function(distance_type: str = \"l2\") -> Callable:\n        \"\"\"Return distance function for given distance type.\"\"\"\n\n        if distance_type == \"mse\":\n            distance = lambda xo, x: torch.mean((xo - x) ** 2, dim=-1)\n        elif distance_type == \"l2\":\n            distance = lambda xo, x: torch.norm((xo - x), dim=-1)\n        elif distance_type == \"l1\":\n            distance = lambda xo, x: torch.mean(abs(xo - x), dim=-1)\n        else:\n            raise ValueError(r\"Distance {distance_type} not supported.\")\n\n        def distance_fun(observed_data: Tensor, simulated_data: Tensor) -> Tensor:\n            \"\"\"Return distance over batch dimension.\n\n            Args:\n                observed_data: Observed data, could be 1D.\n                simulated_data: Batch of simulated data, has batch dimension.\n\n            Returns:\n                Torch tensor with batch of distances.\n            \"\"\"\n            assert simulated_data.ndim == 2, \"simulated data needs batch dimension\"\n\n            return distance(observed_data, simulated_data)\n\n        return distance_fun\n\n    @staticmethod\n    def get_sass_transform(\n        theta: torch.Tensor,\n        x: torch.Tensor,\n        expansion_degree: int = 1,\n        sample_weight=None,\n    ) -> Callable:\n        \"\"\"Return semi-automatic summary statitics function.\n\n        Running weighted linear regressin as in\n        Fearnhead & Prandle 2012: https://arxiv.org/abs/1004.1112\n\n        Following implementation in\n        https://abcpy.readthedocs.io/en/latest/_modules/abcpy/statistics.html#Identity\n        and\n        https://pythonhosted.org/abcpy/_modules/abcpy/summaryselections.html#Semiautomatic\n        \"\"\"\n        expansion = PolynomialFeatures(degree=expansion_degree, include_bias=False)\n        # Transform x, remove intercept.\n        x_expanded = expansion.fit_transform(x)\n        sumstats_map = np.zeros((x_expanded.shape[1], theta.shape[1]))\n\n        for parameter_idx in range(theta.shape[1]):\n            regression_model = LinearRegression(fit_intercept=True)\n            regression_model.fit(\n                X=x_expanded, y=theta[:, parameter_idx], sample_weight=sample_weight\n            )\n            sumstats_map[:, parameter_idx] = regression_model.coef_\n\n        sumstats_map = torch.tensor(sumstats_map, dtype=torch.float32)\n\n        def sumstats_transform(x):\n            x_expanded = torch.tensor(expansion.fit_transform(x), dtype=torch.float32)\n            return x_expanded.mm(sumstats_map)\n\n        return sumstats_transform\n\n    @staticmethod\n    def run_lra(\n        theta: torch.Tensor,\n        x: torch.Tensor,\n        observation: torch.Tensor,\n        sample_weight=None,\n    ) -> torch.Tensor:\n        \"\"\"Return parameters adjusted with linear regression adjustment.\n\n        Implementation as in Beaumont et al. 2002: https://arxiv.org/abs/1707.01254\n        \"\"\"\n\n        theta_adjusted = theta\n        for parameter_idx in range(theta.shape[1]):\n            regression_model = LinearRegression(fit_intercept=True)\n            regression_model.fit(\n                X=x,\n                y=theta[:, parameter_idx],\n                sample_weight=sample_weight,\n            )\n            theta_adjusted[:, parameter_idx] += regression_model.predict(\n                observation.reshape(1, -1)\n            )\n            theta_adjusted[:, parameter_idx] -= regression_model.predict(x)\n\n        return theta_adjusted\n", "path": "sbi/inference/abc/abc_base.py"}], "after_files": [{"content": "import logging\nfrom abc import ABC\nfrom typing import Callable, Union\n\nimport numpy as np\nimport torch\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.preprocessing import PolynomialFeatures\nfrom torch import Tensor\n\nfrom sbi.simulators.simutils import simulate_in_batches\n\n\nclass ABCBASE(ABC):\n    def __init__(\n        self,\n        simulator: Callable,\n        prior,\n        distance: Union[str, Callable] = \"l2\",\n        num_workers: int = 1,\n        simulation_batch_size: int = 1,\n        show_progress_bars: bool = True,\n    ) -> None:\n        r\"\"\"Base class for Approximate Bayesian Computation methods.\n\n        Args:\n            simulator: A function that takes parameters $\\theta$ and maps them to\n                simulations, or observations, `x`, $\\mathrm{sim}(\\theta)\\to x$. Any\n                regular Python callable (i.e. function or class with `__call__` method)\n                can be used.\n            prior: A probability distribution that expresses prior knowledge about the\n                parameters, e.g. which ranges are meaningful for them. Any\n                object with `.log_prob()`and `.sample()` (for example, a PyTorch\n                distribution) can be used.\n            distance: Distance function to compare observed and simulated data. Can be\n                a custom callable function or one of `l1`, `l2`, `mse`.\n            num_workers: Number of parallel workers to use for simulations.\n            simulation_batch_size: Number of parameter sets that the simulator\n                maps to data x at once. If None, we simulate all parameter sets at the\n                same time. If >= 1, the simulator has to process data of shape\n                (simulation_batch_size, parameter_dimension).\n            show_progress_bars: Whether to show a progressbar during simulation and\n                sampling.\n        \"\"\"\n\n        self.prior = prior\n        self._simulator = simulator\n        self._show_progress_bars = show_progress_bars\n\n        # Select distance function.\n        self.distance = self.get_distance_function(distance)\n\n        self._batched_simulator = lambda theta: simulate_in_batches(\n            simulator=self._simulator,\n            theta=theta,\n            sim_batch_size=simulation_batch_size,\n            num_workers=num_workers,\n            show_progress_bars=self._show_progress_bars,\n        )\n\n        self.logger = logging.getLogger(__name__)\n\n    @staticmethod\n    def get_distance_function(distance_type: Union[str, Callable] = \"l2\") -> Callable:\n        \"\"\"Return distance function for given distance type.\n\n        Args:\n            distance_type: string indicating the distance type, e.g., 'l2', 'l1',\n                'mse'. Note that the returned distance function averages over the last\n                dimension, e.g., over the summary statistics.\n\n        Returns:\n            distance_fun: distance functions built from passe string. Returns\n                distance_type is callable.\n        \"\"\"\n\n        if isinstance(distance_type, Callable):\n            return distance_type\n\n        distances = [\"l1\", \"l2\", \"mse\"]\n        assert (\n            distance_type in distances\n        ), f\"{distance_type} must be one of {distances}.\"\n\n        if distance_type == \"mse\":\n            distance = lambda xo, x: torch.mean((xo - x) ** 2, dim=-1)\n        elif distance_type == \"l2\":\n            distance = lambda xo, x: torch.norm((xo - x), dim=-1)\n        elif distance_type == \"l1\":\n            distance = lambda xo, x: torch.mean(abs(xo - x), dim=-1)\n        else:\n            raise ValueError(r\"Distance {distance_type} not supported.\")\n\n        def distance_fun(observed_data: Tensor, simulated_data: Tensor) -> Tensor:\n            \"\"\"Return distance over batch dimension.\n\n            Args:\n                observed_data: Observed data, could be 1D.\n                simulated_data: Batch of simulated data, has batch dimension.\n\n            Returns:\n                Torch tensor with batch of distances.\n            \"\"\"\n            assert simulated_data.ndim == 2, \"simulated data needs batch dimension\"\n\n            return distance(observed_data, simulated_data)\n\n        return distance_fun\n\n    @staticmethod\n    def get_sass_transform(\n        theta: torch.Tensor,\n        x: torch.Tensor,\n        expansion_degree: int = 1,\n        sample_weight=None,\n    ) -> Callable:\n        \"\"\"Return semi-automatic summary statitics function.\n\n        Running weighted linear regressin as in\n        Fearnhead & Prandle 2012: https://arxiv.org/abs/1004.1112\n\n        Following implementation in\n        https://abcpy.readthedocs.io/en/latest/_modules/abcpy/statistics.html#Identity\n        and\n        https://pythonhosted.org/abcpy/_modules/abcpy/summaryselections.html#Semiautomatic\n        \"\"\"\n        expansion = PolynomialFeatures(degree=expansion_degree, include_bias=False)\n        # Transform x, remove intercept.\n        x_expanded = expansion.fit_transform(x)\n        sumstats_map = np.zeros((x_expanded.shape[1], theta.shape[1]))\n\n        for parameter_idx in range(theta.shape[1]):\n            regression_model = LinearRegression(fit_intercept=True)\n            regression_model.fit(\n                X=x_expanded, y=theta[:, parameter_idx], sample_weight=sample_weight\n            )\n            sumstats_map[:, parameter_idx] = regression_model.coef_\n\n        sumstats_map = torch.tensor(sumstats_map, dtype=torch.float32)\n\n        def sumstats_transform(x):\n            x_expanded = torch.tensor(expansion.fit_transform(x), dtype=torch.float32)\n            return x_expanded.mm(sumstats_map)\n\n        return sumstats_transform\n\n    @staticmethod\n    def run_lra(\n        theta: torch.Tensor,\n        x: torch.Tensor,\n        observation: torch.Tensor,\n        sample_weight=None,\n    ) -> torch.Tensor:\n        \"\"\"Return parameters adjusted with linear regression adjustment.\n\n        Implementation as in Beaumont et al. 2002: https://arxiv.org/abs/1707.01254\n        \"\"\"\n\n        theta_adjusted = theta\n        for parameter_idx in range(theta.shape[1]):\n            regression_model = LinearRegression(fit_intercept=True)\n            regression_model.fit(\n                X=x,\n                y=theta[:, parameter_idx],\n                sample_weight=sample_weight,\n            )\n            theta_adjusted[:, parameter_idx] += regression_model.predict(\n                observation.reshape(1, -1)\n            )\n            theta_adjusted[:, parameter_idx] -= regression_model.predict(x)\n\n        return theta_adjusted\n", "path": "sbi/inference/abc/abc_base.py"}]}