text_html_output_1.png
from prophet import Prophet

import matplotlib.pylab as plt # Untuk visualisasi

import pandas as pd # Untuk mengolah data

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

df = pd.read_csv('../input/airpassengers/AirPassengers.csv')

df = df.set_index(['Month'])
df

color_pal = ['#F8766D', '#D39200', '#93AA00', '#00BA38', '#00C19F', '#00B9E3', '#619CFF', '#DB72FB']

test_ratio = 0.2
test_set_size = int(len(df) * test_ratio)
df_train = df[0:-test_set_size].copy()
df_test = df[-test_set_size:].copy()

df_test.rename(columns={'#Passengers': 'TEST SET'}).join(df_train.rename(columns={'#Passengers': 'TRAINING SET'}), how='outer').plot(figsize=(15, 5), title='Penumpang Pesawat', style='-')

df_train.reset_index(inplace=True)

df_train.rename(columns={'Month': 'ds', '#Passengers': 'y'}, inplace=True)

df_test.reset_index(inplace=True)
df_test.rename(columns={'Month': 'ds', '#Passengers': 'y'}, inplace=True)
df_test

model = Prophet()

model.fit(df_train)

hasil_prediksi = model.predict(df_test)

f, ax = plt.subplots(1)
f.set_figheight(5)
f.set_figwidth(15)
fig = model.plot(hasil_prediksi, ax=ax)
plt.show()