mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-19 09:00:59 +00:00
Tqdm flag (#1706)
* add disable_tqdm flag to diagnostics.py * add comment to cross_validation() * Replace boolean comparison operator Co-authored-by: Marius Theiss <justusbersten@gmail.com> * Fix indentation * Restore original indentation Co-authored-by: Filippo Bonaita <filippo.bonaita@corp.badoo.com> Co-authored-by: Marius Theiss <justusbersten@gmail.com>
This commit is contained in:
parent
e41ed25646
commit
3a17402585
1 changed files with 5 additions and 4 deletions
|
|
@ -58,7 +58,7 @@ def generate_cutoffs(df, horizon, initial, period):
|
||||||
return list(reversed(result))
|
return list(reversed(result))
|
||||||
|
|
||||||
|
|
||||||
def cross_validation(model, horizon, period=None, initial=None, parallel=None, cutoffs=None):
|
def cross_validation(model, horizon, period=None, initial=None, parallel=None, cutoffs=None, disable_tqdm=False):
|
||||||
"""Cross-Validation for time series.
|
"""Cross-Validation for time series.
|
||||||
|
|
||||||
Computes forecasts from historical cutoff points, which user can input.
|
Computes forecasts from historical cutoff points, which user can input.
|
||||||
|
|
@ -79,9 +79,10 @@ def cross_validation(model, horizon, period=None, initial=None, parallel=None, c
|
||||||
period will include at least this much data. If not provided,
|
period will include at least this much data. If not provided,
|
||||||
3 * horizon is used.
|
3 * horizon is used.
|
||||||
cutoffs: list of pd.Timestamp specifying cutoffs to be used during
|
cutoffs: list of pd.Timestamp specifying cutoffs to be used during
|
||||||
cross validtation. If not provided, they are generated as described
|
cross validation. If not provided, they are generated as described
|
||||||
above.
|
above.
|
||||||
parallel : {None, 'processes', 'threads', 'dask', object}
|
parallel : {None, 'processes', 'threads', 'dask', object}
|
||||||
|
disable_tqdm: if True it disables the progress bar that would otherwise show up when parallel=None
|
||||||
|
|
||||||
How to parallelize the forecast computation. By default no parallelism
|
How to parallelize the forecast computation. By default no parallelism
|
||||||
is used.
|
is used.
|
||||||
|
|
@ -185,8 +186,8 @@ def cross_validation(model, horizon, period=None, initial=None, parallel=None, c
|
||||||
|
|
||||||
else:
|
else:
|
||||||
predicts = [
|
predicts = [
|
||||||
single_cutoff_forecast(df, model, cutoff, horizon, predict_columns)
|
single_cutoff_forecast(df, model, cutoff, horizon, predict_columns)
|
||||||
for cutoff in tqdm(cutoffs)
|
for cutoff in (tqdm(cutoffs) if not disable_tqdm else cutoffs)
|
||||||
]
|
]
|
||||||
|
|
||||||
# Combine all predicted pd.DataFrame into one pd.DataFrame
|
# Combine all predicted pd.DataFrame into one pd.DataFrame
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue