<jupyter_start><jupyter_text>Exercise 05The result will be evaluated from a report in Jupyter, which must be found in a public GitHub repository.The project must be carried out in the groups assigned in class.Use clear and rigorous procedures.Due date: July 11, 2021, 11:59 pm, through Bloque Neón + (Upload repository link) Using the example_retail_sales dataset:- Standardize the dataset using np.log- Using prophet forescast the next 6 months of the sales logarithm- Predict the next 6 months of sales  Solution<NAME> - 201924178<NAME> - 201527819<NAME>- 202020148<NAME> - 201113765<NAME> - 202022939github: https://github.com/zerodarkzone/AdvancedMethodsDataAnalysisClassGrupo4202119/<jupyter_code>from prophet.plot import add_changepoints_to_plot
from prophet import Prophet
import pandas as pd
import numpy as np
%matplotlib inline<jupyter_output><empty_output><jupyter_text>First, we read the data set using pandas and change de type of the 'ds' column to a datetime.<jupyter_code>retail_sales = pd.read_csv('../datasets/example_retail_sales.csv')
retail_sales["ds"] = pd.to_datetime(retail_sales['ds'])
retail_sales.set_index("ds")['y'].plot()<jupyter_output><empty_output><jupyter_text>We apply the 'log' function to the variable to standardize the data and plot it.<jupyter_code>retail_sales["y"] = np.log(retail_sales["y"])
retail_sales.set_index("ds")['y'].plot()<jupyter_output><empty_output><jupyter_text>At last, we fit the data to the prophet model.<jupyter_code>m = Prophet()
m.fit(retail_sales)<jupyter_output>INFO:prophet:Disabling weekly seasonality. Run prophet with weekly_seasonality=True to override this.
INFO:prophet:Disabling daily seasonality. Run prophet with daily_seasonality=True to override this.<jupyter_text>We make the prediction for the next 6 months<jupyter_code>future = m.make_future_dataframe(periods=6, freq='M')
future.tail(6)<jupyter_output><empty_output><jupyter_text>We make the prediction<jupyter_code>forecast = m.predict(future)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()<jupyter_output><empty_output><jupyter_text>We plot the forecast of the next 6 months and plot the trend and the seasonality of the data<jupyter_code>fig1 = m.plot(forecast)
m.plot_components(forecast);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0987219039224328, 'fraction_numerical': 0.03129131776112825, 'mean_word_length': 7.6311787072243344, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '460832', 'license': 'MIT', 'n_tokens_mistral': 810, 'n_tokens_neox': 724, 'n_words': 205, 'path': 'Exercises/E05-prophet.ipynb', 'repo_name': 'Felipe0812/AdvancedMethodsDataAnalysisClassGrupo4202119', 'size': '2360'}