oshribr
oshribr

Reputation: 666

Facebook Prophet - `k initialized to invalid value (-nan)` in logistic growth

When I'm using prophet with growth == 'logistic' I get the following error k initialized to invalid value (-nan)
After a little debug I found the issue. The issue raises in case the y of the minimum date is half of the y max, and the df['cap_scaled'] == 1.

the following line assigns 2 into r0

r0 = max(1.01, df['cap_scaled'].ix[i0] / df['y_scaled'].ix[i0])

and this line assigns 0 into L0

L0 = np.log(r0 - 1)

this line assigns 0 into m

m = L0 * T / (L0 - L1)

and this line divides by zero

k = L0 / m

How should I fix this?
The workaround I thought about is to subtract or add epsilon to the y in the min date. Is it a good one?

Upvotes: 1

Views: 166

Answers (1)

oshribr
oshribr

Reputation: 666

It was fixed and I think it'll be released in the next version.
For now the workaround should be like this commit.

Upvotes: 1

Related Questions