All problems
Prophet-Style Trend and Seasonality
Problem
Evaluate a Prophet-style point forecast with a linear trend and one sinusoidal seasonality: intercept + slope * t + amplitude * sin(2 * pi * t / period).
Return the forecast for time t.
Hint
At t = period/2 the sine term vanishes; at t = 0 it also vanishes.
Test cases
case 1
in: [0,1,10,2,4]
expected: 10
case 2
in: [1,1,10,2,4]
expected: 13
case 3
in: [2,1,10,2,4]
expected: 12
case 4
in: [1,0,5,0,4]
expected: 5
Starter codePython
import math
def prophet_point(t, trend_slope, trend_intercept, seasonal_amplitude, period):
# Your code here
pass4 test cases · run your code against them in the editor