From eec2f46ac57754718d20be0bf2a4b8d1691a9c3b Mon Sep 17 00:00:00 2001 From: MT Date: Mon, 18 Mar 2019 09:41:45 -0700 Subject: [PATCH] if optimization fails fallback to Newton even if algorithm is specified (#890) --- python/fbprophet/forecaster.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/python/fbprophet/forecaster.py b/python/fbprophet/forecaster.py index 6efbcd9..79b84b3 100644 --- a/python/fbprophet/forecaster.py +++ b/python/fbprophet/forecaster.py @@ -1096,12 +1096,10 @@ class Prophet(object): try: params = model.optimizing(**args) except RuntimeError: - if 'algorithm' not in args: - # Fall back on Newton - args['algorithm'] = 'Newton' - params = model.optimizing(**args) - else: - raise + # Fall back on Newton + args['algorithm'] = 'Newton' + params = model.optimizing(**args) + for par in params: self.params[par] = params[par].reshape((1, -1))