Repository: felipeangelimvieira/prophetverse

Issue:
[MNT] Deprecation of some trend and inference engine arguments
To reduce redundancy and provide a more concise interface, some arguments of Prophetverse's models are being deprecated.


## Trend arguments

Instead of

```python

model = Prophetverse(
    trend="linear",
    changepoint_interval=500,
    changepoint_prior_scale=0.00001,
    changepoint_range=-250,
)
```

Now, user should use:

```python

model = Prophetverse(
    trend=PiecewiseLinearTrend(
        changepoint_interval=500,
        changepoint_prior_scale=0.00001,
        changepoint_range=-250,
    ),
)
```

##  Inference engine and optimization arguments

Instead of 

```python
model = Prophetverse(
      inference_method=MAPInferenceEngine(),
      optimizer_name="Adam",
      optimizer_kwargs={"..."},
)
```

Now users should do

```python

from prophetverse.engine.optimizer import AdamOptimizer
model = Prophetverse(
      inference_method=MAPInferenceEngine(num_steps=1000, optimizer=AdamOptimizer(...),
)
```

Discussion:

Patch:
diff --git a/src/prophetverse/engine/map.py b/src/prophetverse/engine/map.py
index 8434222..293fb6b 100644
--- a/src/prophetverse/engine/map.py
+++ b/src/prophetverse/engine/map.py
@@ -17,7 +17,6 @@ from prophetverse.engine.optimizer.optimizer import (
     AdamOptimizer,
     BaseOptimizer,
     LBFGSSolver,
-    _OptimizerFromCallable,
 )
 from prophetverse.utils.deprecation import deprecation_warning
 
diff --git a/src/prophetverse/engine/optimizer/__init__.py b/src/prophetverse/engine/optimizer/__init__.py
index c6eafbd..5c8948f 100644
--- a/src/prophetverse/engine/optimizer/__init__.py
+++ b/src/prophetverse/engine/optimizer/__init__.py
@@ -5,9 +5,7 @@ from .optimizer import (
     BaseOptimizer,
     CosineScheduleAdamOptimizer,
     LBFGSSolver,
-    _LegacyNumpyroOptimizer,
     _NumPyroOptim,
-    _OptimizerFromCallable,
 )
 
 __all__ = [
diff --git a/src/prophetverse/sktime/base.py b/src/prophetverse/sktime/base.py
index 3414e6e..1c30e72 100644
--- a/src/prophetverse/sktime/base.py
+++ b/src/prophetverse/sktime/base.py
@@ -26,12 +26,11 @@ from prophetverse.engine import (
     MAPInferenceEngine,
     MCMCInferenceEngine,
 )
-from prophetverse.engine.optimizer.optimizer import (
-    CosineScheduleAdamOptimizer,
-    _LegacyNumpyroOptimizer,
-)
+from prophetverse.engine.optimizer.optimizer import CosineScheduleAdamOptimizer
 from prophetverse.utils import get_multiindex_loc
 
+_VALID_TREND_STRINGS = ["linear", "logistic", "flat"]
+
 
 class BaseBayesianForecaster(BaseForecaster):
     """
@@ -248,7 +247,7 @@ class BaseBayesianForecaster(BaseForecaster):
             names as columns and the forecast horizon as the index.
         """
         if self._is_vectorized:
-            return self._vectorize_predict_method("predict_all_sites", X=X, fh=fh)
+            return self._vectorize_predict_method("predict_components", X=X, fh=fh)
 
         fh_as_index = self.fh_to_index(fh)
         predictive_samples_ = self._get_predictive_samples_dict(fh=fh, X=X)
@@ -336,7 +335,7 @@ class BaseBayesianForecaster(BaseForecaster):
         """
         if self._is_vectorized:
             return self._vectorize_predict_method(
-                "predict_all_sites_samples", X=X, fh=fh
+                "predict_component_samples", X=X, fh=fh
             )
 
         predictive_samples_ = self._get_predictive_samples_dict(fh=fh, X=X)
@@ -976,33 +975,27 @@ class BaseProphetForecaster(_HeterogenousMetaEstimator, BaseBayesianForecaster):
             or a BaseEffect instance.
         """
         if isinstance(self.trend, str):
+            if self.trend == "linear":
+                return PiecewiseLinearTrend()
+            elif self.trend == "logistic":
+                return PiecewiseLogisticTrend()
             # Raise error because self.trend str is deprecated since 0.6.0
-            raise ValueError(
-                "String values for trend are deprecated since 0.6.0. "
-                "Please use a effect instance, such as PiecewiseLinearEffect."
-            )
+            elif self.trend == "flat":
+                return FlatTrend()
 
-        return self.trend
+        if isinstance(self.trend, BaseEffect):
+            return self.trend
+        raise ValueError(f"trend must be in {_VALID_TREND_STRINGS} or be a Effect")
 
     def _validate_hyperparams(self):
         """Validate the hyperparameters."""
-        if self.changepoint_interval <= 0:
-            raise ValueError("changepoint_interval must be greater than 0.")
-        if self.changepoint_prior_scale <= 0:
-            raise ValueError("changepoint_prior_scale must be greater than 0.")
-        if self.capacity_prior_scale <= 0:
-            raise ValueError("capacity_prior_scale must be greater than 0.")
-        if self.capacity_prior_loc <= 0:
-            raise ValueError("capacity_prior_loc must be greater than 0.")
-        if self.offset_prior_scale <= 0:
-            raise ValueError("offset_prior_scale must be greater than 0.")
-        if self.trend not in [
-            "linear",
-            "linear_raw",
-            "logistic",
-            "flat",
-        ] and not isinstance(self.trend, BaseEffect):
-            raise ValueError('trend must be either "linear" or "logistic".')
+
+        if self.trend not in _VALID_TREND_STRINGS and not isinstance(
+            self.trend, BaseEffect
+        ):
+            raise ValueError(
+                f"trend must be in {_VALID_TREND_STRINGS} or be a Effect"  # noqa
+            )
 
     def _match_columns(
         self, columns: Union[pd.Index, List[str]], regex: Union[str, None]
diff --git a/src/prophetverse/sktime/multivariate.py b/src/prophetverse/sktime/multivariate.py
index c84afd6..f5c7d54 100644
--- a/src/prophetverse/sktime/multivariate.py
+++ b/src/prophetverse/sktime/multivariate.py
@@ -151,23 +151,10 @@ class HierarchicalProphet(BaseProphetForecaster):
     def __init__(
         self,
         trend: Union[BaseEffect, str] = "linear",
-        changepoint_interval: int = 25,
-        changepoint_range: Union[float, int] = 0.8,
-        changepoint_prior_scale: float = 0.001,
-        offset_prior_scale: float = 0.1,
-        capacity_prior_scale=0.2,
-        capacity_prior_loc=1.1,
         feature_transformer: BaseTransformer = None,
         exogenous_effects=None,
         default_effect=None,
         shared_features=None,
-        mcmc_samples=2000,
-        mcmc_warmup=200,
-        mcmc_chains=4,
-        inference_method="map",
-        optimizer_name="Adam",
-        optimizer_kwargs=None,
-        optimizer_steps=100_000,
         noise_scale=0.05,
         correlation_matrix_concentration=1.0,
         rng_key=None,
@@ -182,25 +169,12 @@ class HierarchicalProphet(BaseProphetForecaster):
         super().__init__(
             # Trend
             trend=trend,
-            changepoint_interval=changepoint_interval,
-            changepoint_range=changepoint_range,
-            changepoint_prior_scale=changepoint_prior_scale,
-            offset_prior_scale=offset_prior_scale,
-            capacity_prior_scale=capacity_prior_scale,
-            capacity_prior_loc=capacity_prior_loc,
             # Exog effects
             default_effect=default_effect,
             exogenous_effects=exogenous_effects,
             # Base Bayesian forecaster
             rng_key=rng_key,
             inference_engine=inference_engine,
-            inference_method=inference_method,
-            optimizer_name=optimizer_name,
-            optimizer_kwargs=optimizer_kwargs,
-            optimizer_steps=optimizer_steps,
-            mcmc_samples=mcmc_samples,
-            mcmc_warmup=mcmc_warmup,
-            mcmc_chains=mcmc_chains,
         )
 
         self.model = multivariate_model  # type: ignore[method-assign]
@@ -436,15 +410,19 @@ class HierarchicalProphet(BaseProphetForecaster):
         List[dict[str, int]]
             A list of dictionaries containing the test parameters.
         """
+        from prophetverse.engine.map import MAPInferenceEngine
+        from prophetverse.engine.mcmc import MCMCInferenceEngine
+        from prophetverse.engine.optimizer import AdamOptimizer
+
         return [
             {
-                "optimizer_steps": 1,
-                "inference_method": "map",
+                "inference_engine": MAPInferenceEngine(
+                    num_steps=1, optimizer=AdamOptimizer()
+                )
             },
             {
-                "inference_method": "mcmc",
-                "mcmc_samples": 1,
-                "mcmc_warmup": 1,
-                "mcmc_chains": 1,
+                "inference_engine": MCMCInferenceEngine(
+                    num_samples=1, num_warmup=1, num_chains=1
+                ),
             },
         ]
diff --git a/src/prophetverse/sktime/univariate.py b/src/prophetverse/sktime/univariate.py
index d8b447f..0302085 100644
--- a/src/prophetverse/sktime/univariate.py
+++ b/src/prophetverse/sktime/univariate.py
@@ -195,9 +195,7 @@ class Prophetverse(BaseProphetForecaster):
             "trend_model": self.trend_model_,
             "noise_scale": self.noise_scale,
             "scale": self._scale,
-            "exogenous_effects": (
-                self.non_skipped_exogenous_effect if self._has_exogenous else None
-            ),
+            "exogenous_effects": self.non_skipped_exogenous_effect,
         }
 
         inputs = {
@@ -237,9 +235,7 @@ class Prophetverse(BaseProphetForecaster):
 
         trend_data = self.trend_model_.transform(X=X, fh=fh_as_index)
 
-        exogenous_data = (
-            self._transform_effects(X, fh_as_index) if self._has_exogenous else None
-        )
+        exogenous_data = self._transform_effects(X, fh_as_index)
 
         return dict(
             y=None,
@@ -263,12 +259,15 @@ class Prophetverse(BaseProphetForecaster):
             A list of dictionaries containing test parameters.
         """
         from prophetverse.effects.trend import FlatTrend
-        from prophetverse.engine import MCMCInferenceEngine
+        from prophetverse.engine import MCMCInferenceEngine, MAPInferenceEngine
+        from prophetverse.engine.optimizer import AdamOptimizer
 
         params = [
             {
-                "optimizer_steps": 1,
-                "inference_method": "map",
+                "trend": FlatTrend(),
+                "inference_engine": MAPInferenceEngine(
+                    num_steps=1, optimizer=AdamOptimizer()
+                ),
             },
             {
                 "inference_engine": MCMCInferenceEngine(
@@ -314,6 +313,7 @@ class Prophet(Prophetverse):
         default_effect=None,
         scale=None,
         rng_key=None,
+        inference_engine=None,
     ):
         super().__init__(
             feature_transformer=feature_transformer,
@@ -324,6 +324,7 @@ class Prophet(Prophetverse):
             default_effect=default_effect,
             scale=scale,
             rng_key=rng_key,
+            inference_engine=inference_engine,
         )
 
 
@@ -354,6 +355,7 @@ class ProphetGamma(Prophetverse):
         default_effect=None,
         scale=None,
         rng_key=None,
+        inference_engine=None,
     ):
         super().__init__(
             noise_scale=noise_scale,
@@ -363,6 +365,7 @@ class ProphetGamma(Prophetverse):
             default_effect=default_effect,
             scale=scale,
             rng_key=rng_key,
+            inference_engine=inference_engine,
         )
 
 
@@ -393,6 +396,7 @@ class ProphetNegBinomial(Prophetverse):
         default_effect=None,
         scale=None,
         rng_key=None,
+        inference_engine=None,
     ):
         super().__init__(
             noise_scale=noise_scale,
@@ -402,4 +406,5 @@ class ProphetNegBinomial(Prophetverse):
             default_effect=default_effect,
             scale=scale,
             rng_key=rng_key,
+            inference_engine=inference_engine,
         )


Test patch:
diff --git a/tests/engine/test_map.py b/tests/engine/test_map.py
index b974ed2..11483c4 100644
--- a/tests/engine/test_map.py
+++ b/tests/engine/test_map.py
@@ -3,6 +3,7 @@ import pytest
 from numpyro.infer.svi import SVIRunResult
 
 from prophetverse.engine import MAPInferenceEngine, MAPInferenceEngineError
+from prophetverse.engine.optimizer import AdamOptimizer
 
 
 def test_raises_error_when_nan_loss():
@@ -17,7 +18,7 @@ def test_raises_error_when_nan_loss():
         params={"param1": jnp.array([1, 2, 3])}, state=None, losses=jnp.array([1, 2, 3])
     )
 
-    inf_engine = MAPInferenceEngine(lambda *args: None)
+    inf_engine = MAPInferenceEngine(optimizer=AdamOptimizer())
 
     assert inf_engine.raise_error_if_nan_loss(good_svi_result) is None
     with pytest.raises(MAPInferenceEngineError):
diff --git a/tests/sktime/_utils.py b/tests/sktime/_utils.py
index 2652a22..84fc251 100644
--- a/tests/sktime/_utils.py
+++ b/tests/sktime/_utils.py
@@ -9,12 +9,12 @@ from sktime.utils._testing.hierarchical import _bottom_hier_datagen, _make_hiera
 
 from prophetverse.effects.linear import LinearEffect
 from prophetverse.sktime.multivariate import HierarchicalProphet
-from prophetverse.sktime.seasonality import seasonal_transformer
+
 
 EXTRA_FORECAST_FUNCS = [
     "predict_interval",
-    "predict_all_sites",
-    "predict_all_sites_samples",
+    "predict_components",
+    "predict_component_samples",
     "predict_samples",
 ]
 
diff --git a/tests/sktime/test_multivariate.py b/tests/sktime/test_multivariate.py
index e51587e..9490a2f 100644
--- a/tests/sktime/test_multivariate.py
+++ b/tests/sktime/test_multivariate.py
@@ -2,9 +2,11 @@ import pytest
 from numpyro import distributions as dist
 
 from prophetverse.effects.linear import LinearEffect
-from prophetverse.effects.trend import PiecewiseLinearTrend
+
+from prophetverse.effects import LinearFourierSeasonality
 from prophetverse.sktime.multivariate import HierarchicalProphet
-from prophetverse.sktime.seasonality import seasonal_transformer
+from prophetverse.engine import MAPInferenceEngine
+from prophetverse.engine.optimizer import AdamOptimizer
 
 from ._utils import (
     execute_extra_predict_methods_tests,
@@ -15,28 +17,23 @@ from ._utils import (
     make_y,
 )
 
+SEASONAL_EFFECT = (
+    "seasonality",
+    LinearFourierSeasonality(sp_list=[7, 365.25], fourier_terms_list=[1, 1], freq="D"),
+    None,
+)
+
 HYPERPARAMS = [
     dict(
-        trend=PiecewiseLinearTrend(
-            changepoint_interval=20,
-            changepoint_range=0.8,
-            changepoint_prior_scale=0.001,
-        ),
-        feature_transformer=seasonal_transformer(
-            yearly_seasonality=True, weekly_seasonality=True
-        ),
+        exogenous_effects=[SEASONAL_EFFECT],
     ),
     dict(
-        feature_transformer=seasonal_transformer(
-            yearly_seasonality=True, weekly_seasonality=True
-        ),
+        exogenous_effects=[SEASONAL_EFFECT],
         default_effect=LinearEffect(effect_mode="multiplicative"),
     ),
     dict(
-        feature_transformer=seasonal_transformer(
-            yearly_seasonality=True, weekly_seasonality=True
-        ),
         exogenous_effects=[
+            SEASONAL_EFFECT,
             ("lineareffect1", LinearEffect(), r"(x1).*"),
             ("lineareffect1_repeated", LinearEffect(), r"(x1).*"),
             ("lineareffect2", LinearEffect(prior=dist.Laplace(0, 1)), r"(x2).*"),
@@ -48,14 +45,16 @@ HYPERPARAMS = [
         ],
     ),
     dict(
-        trend="linear_raw",
+        trend="linear",
     ),
-    dict(trend="logistic"),
-    dict(inference_method="mcmc"),
     dict(
-        feature_transformer=seasonal_transformer(
-            yearly_seasonality=True, weekly_seasonality=True
-        ),
+        trend="logistic",
+    ),
+    dict(),
+    dict(
+        exogenous_effects=[
+            SEASONAL_EFFECT,
+        ],
         shared_features=["x1"],
     ),
 ]
@@ -67,7 +66,10 @@ def test_hierarchy_levels(hierarchy_levels):
     y = make_y(hierarchy_levels)
     X = make_random_X(y)
     forecaster = HierarchicalProphet(
-        optimizer_steps=2, changepoint_interval=2, mcmc_samples=2, mcmc_warmup=2
+        trend="linear",
+        inference_engine=MAPInferenceEngine(
+            optimizer=AdamOptimizer(), num_steps=1, num_samples=1
+        ),
     )
     execute_fit_predict_test(forecaster, y, X)
 
@@ -80,10 +82,9 @@ def test_hyperparams(hyperparams):
     X = make_random_X(y)
     forecaster = HierarchicalProphet(
         **hyperparams,
-        optimizer_steps=2,
-        changepoint_interval=2,
-        mcmc_samples=2,
-        mcmc_warmup=2
+        inference_engine=MAPInferenceEngine(
+            optimizer=AdamOptimizer(), num_steps=1, num_samples=1
+        ),
     )
     execute_fit_predict_test(forecaster, y, X)
 
@@ -99,10 +100,9 @@ def test_prophet2_fit_with_different_nlevels(hierarchy_levels, make_X, hyperpara
 
     forecaster = HierarchicalProphet(
         **hyperparams,
-        optimizer_steps=20,
-        changepoint_interval=2,
-        mcmc_samples=2,
-        mcmc_warmup=2
+        inference_engine=MAPInferenceEngine(
+            optimizer=AdamOptimizer(), num_steps=1, num_samples=1
+        ),
     )
 
     execute_fit_predict_test(forecaster, y, X)
@@ -113,7 +113,9 @@ def test_extra_predict_methods(make_X):
     y = make_y((2, 1))
     X = make_X(y)
     forecaster = HierarchicalProphet(
-        optimizer_steps=20, changepoint_interval=2, mcmc_samples=2, mcmc_warmup=2
+        inference_engine=MAPInferenceEngine(
+            optimizer=AdamOptimizer(), num_steps=1, num_samples=1
+        ),
     )
 
     execute_extra_predict_methods_tests(forecaster=forecaster, X=X, y=y)
@@ -125,7 +127,9 @@ def test_hierarchical_with_series_with_zeros():
     y.iloc[:, :] = 0
 
     forecaster = HierarchicalProphet(
-        optimizer_steps=5, changepoint_interval=2, mcmc_samples=2, mcmc_warmup=2
+        inference_engine=MAPInferenceEngine(
+            optimizer=AdamOptimizer(), num_steps=1, num_samples=1
+        )
     )
 
     forecaster.fit(y)
diff --git a/tests/sktime/test_seasonality.py b/tests/sktime/test_seasonality.py
deleted file mode 100644
index e2efce0..0000000
--- a/tests/sktime/test_seasonality.py
+++ /dev/null
@@ -1,57 +0,0 @@
-import pytest
-import pandas as pd
-from prophetverse.sktime.seasonality import (
-    seasonal_transformer,
-) 
-
-from sktime.transformations.series.fourier import FourierFeatures
-
-
-def test_valid_input_boolean():
-    # Test for valid boolean inputs
-    transformer = seasonal_transformer(yearly_seasonality=True, weekly_seasonality=True)
-    assert isinstance(
-        transformer, FourierFeatures
-    ), "Output should be FourierFeatures"
-
-
-def test_valid_input_integer():
-    # Test for valid integer inputs
-    transformer = seasonal_transformer(yearly_seasonality=12, weekly_seasonality=4)
-    assert isinstance(
-        transformer, FourierFeatures
-    ), "Output should be FourierFeatures"
-
-
-def test_invalid_input():
-    # Test for invalid inputs
-    with pytest.raises(ValueError):
-        _ = seasonal_transformer(yearly_seasonality="yearly", weekly_seasonality=3)
-    with pytest.raises(ValueError):
-        _ = seasonal_transformer(yearly_seasonality=10, weekly_seasonality="weekly")
-
-
-def test_no_seasonality():
-    # Test with no seasonality
-    transformer = seasonal_transformer(
-        yearly_seasonality=False, weekly_seasonality=False
-    )
-    assert isinstance(
-        transformer, FourierFeatures
-    ), "Output should be FourierFeatures"
-
-
-def test_mixed_validity():
-    # Test with one valid and one invalid input
-    with pytest.raises(ValueError):
-        _ = seasonal_transformer(yearly_seasonality=True, weekly_seasonality="some")
-    with pytest.raises(ValueError):
-        _ = seasonal_transformer(yearly_seasonality="some", weekly_seasonality=True)
-
-
-def test_frequency_handling():
-    # Test different frequency inputs
-    transformer = seasonal_transformer(freq="M")
-    assert (
-        transformer.get_params()["freq"] == "M"
-    ), "Frequency parameter not set correctly"
diff --git a/tests/sktime/test_univariate.py b/tests/sktime/test_univariate.py
index d671ecc..2fab621 100644
--- a/tests/sktime/test_univariate.py
+++ b/tests/sktime/test_univariate.py
@@ -3,7 +3,7 @@ from numpyro import distributions as dist
 
 from prophetverse.effects.linear import LinearEffect
 from prophetverse.effects.trend.flat import FlatTrend
-from prophetverse.sktime.seasonality import seasonal_transformer
+from prophetverse.effects import LinearFourierSeasonality
 from prophetverse.sktime.univariate import (
     _DISCRETE_LIKELIHOODS,
     _LIKELIHOOD_MODEL_MAP,
@@ -13,6 +13,9 @@ from prophetverse.sktime.univariate import (
     Prophetverse,
 )
 
+from prophetverse.engine import MAPInferenceEngine
+from prophetverse.engine.optimizer import AdamOptimizer
+
 from ._utils import (
     execute_extra_predict_methods_tests,
     execute_fit_predict_test,
@@ -28,24 +31,23 @@ MODELS = [
     ProphetNegBinomial,
 ]
 
+SEASONAL_EFFECT = (
+    "seasonality",
+    LinearFourierSeasonality(sp_list=[7, 365.25], fourier_terms_list=[1, 1], freq="D"),
+    None,
+)
 HYPERPARAMS = [
     dict(
         trend=FlatTrend(),
-        feature_transformer=seasonal_transformer(
-            yearly_seasonality=True, weekly_seasonality=True
-        ),
+        exogenous_effects=[SEASONAL_EFFECT],
     ),
     dict(
-        feature_transformer=seasonal_transformer(
-            yearly_seasonality=True, weekly_seasonality=True
-        ),
+        exogenous_effects=[SEASONAL_EFFECT],
         default_effect=LinearEffect(effect_mode="multiplicative"),
     ),
     dict(
-        feature_transformer=seasonal_transformer(
-            yearly_seasonality=True, weekly_seasonality=True
-        ),
         exogenous_effects=[
+            SEASONAL_EFFECT,
             ("lineareffect1", LinearEffect(), r"(x1).*"),
             ("lineareffect1_repeated", LinearEffect(), r"(x1).*"),
             ("lineareffect2", LinearEffect(prior=dist.Laplace(0, 1)), r"(x2).*"),
@@ -59,9 +61,8 @@ HYPERPARAMS = [
     dict(
         trend="linear",
     ),
-    dict(trend="logistic", offset_prior_scale=0.5),
+    dict(trend="logistic"),
     dict(trend="flat"),
-    dict(inference_method="mcmc"),
 ]
 
 
@@ -75,7 +76,10 @@ def test_model_class_fit(model_class):
     y = make_y(hierarchy_levels)
     X = make_X(y)
     forecaster = model_class(
-        **hyperparams, optimizer_steps=10, mcmc_samples=2, mcmc_warmup=2, mcmc_chains=1
+        **hyperparams,
+        inference_engine=MAPInferenceEngine(
+            optimizer=AdamOptimizer(), num_steps=1, num_samples=1
+        )
     )
 
     execute_fit_predict_test(forecaster, y, X, test_size=4)
@@ -91,7 +95,10 @@ def test_hierarchy_levels_fit(hierarchy_levels):
     y = make_y(hierarchy_levels)
     X = make_X(y)
     forecaster = model_class(
-        **hyperparams, optimizer_steps=10, mcmc_samples=2, mcmc_warmup=2, mcmc_chains=1
+        **hyperparams,
+        inference_engine=MAPInferenceEngine(
+            optimizer=AdamOptimizer(), num_steps=1, num_samples=1
+        )
     )
 
     execute_fit_predict_test(forecaster, y, X, test_size=4)
@@ -107,7 +114,10 @@ def test_hyperparams_fit(hyperparams):
     y = make_y(hierarchy_levels)
     X = make_X(y)
     forecaster = model_class(
-        **hyperparams, optimizer_steps=10, mcmc_samples=2, mcmc_warmup=2, mcmc_chains=1
+        **hyperparams,
+        inference_engine=MAPInferenceEngine(
+            optimizer=AdamOptimizer(), num_steps=1, num_samples=1
+        )
     )
 
     execute_fit_predict_test(forecaster, y, X, test_size=4)
@@ -118,7 +128,9 @@ def test_extra_predict_methods(make_X):
     y = make_y((2, 1))
     X = make_X(y)
     forecaster = Prophet(
-        optimizer_steps=10, mcmc_samples=2, mcmc_warmup=2, mcmc_chains=1
+        inference_engine=MAPInferenceEngine(
+            optimizer=AdamOptimizer(), num_steps=1, num_samples=1
+        )
     )
     execute_extra_predict_methods_tests(forecaster=forecaster, X=X, y=y)
 
@@ -135,7 +147,10 @@ def test_prophet2_fit_with_different_nlevels(
     y = make_y(hierarchy_levels)
     X = make_X(y)
     forecaster = model_class(
-        **hyperparams, optimizer_steps=100, mcmc_samples=2, mcmc_warmup=2, mcmc_chains=1
+        **hyperparams,
+        inference_engine=MAPInferenceEngine(
+            optimizer=AdamOptimizer(), num_steps=1, num_samples=1
+        )
     )
 
     execute_fit_predict_test(forecaster, y, X, test_size=4)
@@ -146,9 +161,6 @@ def test_prophet2_fit_with_different_nlevels(
     [
         dict(trend="bad_trend"),
         dict(likelihood="bad_likelihood"),
-        dict(offset_prior_scale=-1),
-        dict(capacity_prior_scale=-1),
-        dict(changepoint_interval=-1),
     ],
 )
 def test_raise_error_when_passing_parameters(parameters):