Prophet models a series as a trend plus seasonality. Given fitted parameters, evaluate both components and their sum.
Implement prophet_components(t, k, m, changepoints, deltas, period, fourier).
Trend. Base rate k, offset m, changepoints s1<⋯<sS with rate changes δ1,…,δS. With aj(t)=1 if t≥sj else 0, and γj=−sjδj,
g(t)=(k+∑jaj(t)δj)t+(m+∑jaj(t)γj).
Seasonality. fourier is a list of pairs (an,bn) for n=1,…,N (possibly empty), with period P:
s(t)=∑n=1Nancos(P2πnt)+bnsin(P2πnt).
Output. A dict with
"trend": g(t) for each time in t,
"seasonality": s(t) for each time,
"yhat": g(t)+s(t),
"rates": the growth rate in each segment, [k, k+δ1, k+δ1+δ2,…] (S+1 values).
All values are lists of floats rounded to 4 decimals.