prophet icon indicating copy to clipboard operation
prophet copied to clipboard

may be a math problem

Open stevenjk2012 opened this issue 9 years ago • 1 comments

Seasonality features

    if self.yearly_seasonality:
        seasonal_features.append(self.make_seasonality_features(
            df['ds'],
            365.25,
            10,#?
            'yearly',
        ))

    if self.weekly_seasonality:
        seasonal_features.append(self.make_seasonality_features(
            df['ds'],
            7,
            3,#?
            'weekly',
        ))

I don't understand the 3rd parameter,why yearly is 10, why weekly is 3 ? Fourier series?

stevenjk2012 avatar Mar 13 '17 02:03 stevenjk2012

Yes, this depends on Fourier Series. 10 means you are taking 10 terms of Fourier series i.e. total of 21 values including the value of constant term i.e. a0 of a0 + a1sin(2pit/T) + a2cos(2pit/T) + ..

More number of terms might lead to over-fitting and less will lead to under-fitting. So, prophet team would have found that for yearly 10 terms work and for weekly 3 terms work best. However, you can make it as hyper-parameter and can check the results for multiple terms.

Hope this helps!

iampawansingh avatar Mar 13 '17 04:03 iampawansingh