facebook / facebook/prophet

Calling `cross_validation(model)` without `model.fit` throws AttributeError

Open
#2,132 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
20.4k
Forks
4.6k
Avg merge
19h 52m
Merged PRs (30d)
1

Description

Calling `cross_validation(model)` without calling `model.fit` first throws AttributeError.

```
[def cross_validation(model, horizon, period=None, initial=None, parallel=None, cutoffs=None):]()
...
df = model.history.copy().reset_index(drop=True]()

AttributeError: 'NoneType' object has no attribute 'copy']()
```

1. If `fit` is required to be run before `cross_validation`, I would expect an appropriate error to be thrown with an actionable fix by the user.
2. Assuming that the assumption in 1) is true, why does `fit` have to be called first? As I understand, `fit` uses the entire history to fit the model. Even though `cross_validation` purports to fit using each fold, it's not obvious from the API that the preceding `fit` procedure won't cause temporal leakage.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.