Repository: sktime/sktime

Issue:
[BUG] Prophet adapter fails to clone after setting parameters
**Describe the bug**
<!--
A clear and concise description of what the bug is.
-->

Using sklearn's `clone` on `Prophet` after either `seasonality_prior_scale`, `changepoint_prior_scale` or `holidays_prior_scale` were set with a non-float value through `set_params` will raise a `RuntimeError` during cloning. This is due to the `float` conversion happening in `__init__`, which is against what sklearn expects during cloning - it expects that all of the values passed as arguments to `__init__` will not be modified in any way when being set as object attributes.

**To Reproduce**
<!--
Add a Minimal, Complete, and Verifiable example (for more details, see e.g. https://stackoverflow.com/help/mcve

If the code is too long, feel free to put it in a public gist and link it in the issue: https://gist.github.com
-->

```python
from sktime.forecasting.fbprophet import Prophet
from sklearn.base import clone
model = Prophet()
model.set_params(changepoint_prior_scale=1)
clone(model)
```

This will raise a sklearn `RuntimeError`.

**Expected behavior**
<!--
A clear and concise description of what you expected to happen.
-->

No exception is raised.

**Additional context**
<!--
Add any other context about the problem here.
-->

**Versions**
<details>

<!--
Please run the following code snippet and paste the output here:
 
from sktime import show_versions; show_versions()
-->
```
System:
    python: 3.8.5 (default, Sep  4 2020, 07:30:14)  [GCC 7.3.0]
executable: /home/baum/anaconda3/bin/python
   machine: Linux-5.11.0-7614-generic-x86_64-with-glibc2.10

Python dependencies:
          pip: 20.2.4
   setuptools: 50.3.1.post20201107
      sklearn: 0.23.2
       sktime: 0.5.3
  statsmodels: 0.12.2
        numpy: 1.20.1
        scipy: 1.6.1
       Cython: 0.29.17
       pandas: 1.2.3
   matplotlib: 3.4.1
       joblib: 1.0.1
        numba: 0.51.2
     pmdarima: 1.8.0
      tsfresh: None
```
</details>

<!-- Thanks for contributing! -->



Discussion:

Resolving patch:
diff --git a/sktime/forecasting/fbprophet.py b/sktime/forecasting/fbprophet.py
--- a/sktime/forecasting/fbprophet.py
+++ b/sktime/forecasting/fbprophet.py
@@ -2,6 +2,8 @@
 # -*- coding: utf-8 -*-
 # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
 
+"""Prophet forecaster by wrapping fbprophet."""
+
 __author__ = ["Martin Walter"]
 __all__ = ["Prophet"]
 
@@ -14,6 +16,7 @@
 
 class Prophet(_ProphetAdapter):
     """Prophet forecaster by wrapping fbprophet.
+
     Parameters
     ----------
     freq: String of DatetimeIndex frequency. See here for possible values:
@@ -136,9 +139,9 @@ def __init__(
         self.daily_seasonality = daily_seasonality
         self.holidays = holidays
         self.seasonality_mode = seasonality_mode
-        self.seasonality_prior_scale = float(seasonality_prior_scale)
-        self.changepoint_prior_scale = float(changepoint_prior_scale)
-        self.holidays_prior_scale = float(holidays_prior_scale)
+        self.seasonality_prior_scale = seasonality_prior_scale
+        self.changepoint_prior_scale = changepoint_prior_scale
+        self.holidays_prior_scale = holidays_prior_scale
         self.mcmc_samples = mcmc_samples
         self.alpha = alpha
         self.uncertainty_samples = uncertainty_samples
@@ -163,9 +166,9 @@ def _instantiate_model(self):
             daily_seasonality=self.daily_seasonality,
             holidays=self.holidays,
             seasonality_mode=self.seasonality_mode,
-            seasonality_prior_scale=self.seasonality_prior_scale,
-            holidays_prior_scale=self.holidays_prior_scale,
-            changepoint_prior_scale=self.changepoint_prior_scale,
+            seasonality_prior_scale=float(self.seasonality_prior_scale),
+            holidays_prior_scale=float(self.holidays_prior_scale),
+            changepoint_prior_scale=float(self.changepoint_prior_scale),
             mcmc_samples=self.mcmc_samples,
             interval_width=1 - self.alpha,
             uncertainty_samples=self.uncertainty_samples,


Test patch: