Add progress bar to cross_validation (#1338)

* tqdm

* Added progress bar to the crossvalidation

In order to improve the user experiance a progress bar is added to the crossvalidation loop.

* Update requirements.txt

* Update python/fbprophet/diagnostics.py

* updated further

* Update requirements.txt
This commit is contained in:
Ben Letham 2020-03-04 16:01:02 -08:00 committed by GitHub
parent 952b544928
commit d8dd2f53b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -7,6 +7,7 @@
from __future__ import absolute_import, division, print_function
import logging
from tqdm.autonotebook import tqdm
from copy import deepcopy
from functools import reduce
@ -54,7 +55,7 @@ def generate_cutoffs(df, horizon, initial, period):
logger.info('Making {} forecasts with cutoffs between {} and {}'.format(
len(result), result[-1], result[0]
))
return reversed(result)
return list(reversed(result))
def cross_validation(model, horizon, period=None, initial=None):
@ -107,7 +108,7 @@ def cross_validation(model, horizon, period=None, initial=None):
cutoffs = generate_cutoffs(df, horizon, initial, period)
predicts = []
for cutoff in cutoffs:
for cutoff in tqdm(cutoffs):
# Generate new object with copying fitting options
m = prophet_copy(model, cutoff)
# Train model

View file

@ -9,3 +9,4 @@ convertdate>=2.1.2
holidays>=0.9.5
setuptools-git>=1.2
python-dateutil>=2.8.0
tqdm>=4.42.1