Original Source Here
Fitting the model:
Our model will be defined as an instance of Prophet() and fit on the dataset using the function fit().
Prophet() takes the arguments to factor in type of growth, type of seasonality etc. but even if no arguments are given, it mostly figures out everything automatically.
The fit() function takes dataframe as an object but in a specific format. The first column should be named ‘ds‘ and it contains the date-times. The second column should be named ‘y‘ and it contains the values.
So we rename the columns accordingly and convert the first column values to date-time objects.
from pandas import to_datetimedf.columns = ['ds', 'y']
Fitting our model to the dataset:
from fbprophet import Prophetmodel = Prophet()
Weekly and daily seasonality are disabled since our data is of monthly frequency. But we can get a sense of monthly trend and the general trend overall using the following code.
The above figures indicate the number of passengers travelled is generally increasing and it peaks around July every year.
Trending AI/ML Article Identified & Digested via Granola by Ramsey Elbasheer; a Machine-Driven RSS Bot