Stock Price Prediction means to determine the future value of the stocks or other financial instruments of an organisation. If you master the art to predict stock prices, you can earn a lot by investing and selling at the right time, and you can even earn by mentoring other people who want to explore trading.

**Facebook Prophet Model**

Facebook Prophet is an algorithm developed by Facebook’s Core Data Science team. It is used in the applications of time series forecasting. It is very much used when there is a possibility of seasonal effects. The Time Series Forecasting is very much used in Stock Price Prediction. In this article, I will take you through the application of Facebook Prophet model for Google Stock Price Prediction.

**Stock Price Prediction using Facebook Prophet Model**

I will use the latest dataset that I just downloaded from **yahoo finance**. If you want to practice this task on the same dataset that I have taken, then you can download it **here**.

If you want to practice this on the latest dataset when you are reading this article, then you can download the latest one from the **yahoo finance**. If you find any problem in downloading the latest dataset you can mention in the comments section below; I will help you out with that.

To predict stock prices using the Facebook Prophet model, you have to install a package named fbprophet, which can be easily installed using the pip command- **pip install fbprophet**. I hope you have installed this package and now let’s move further by importing the necessary packages we need for this task:

```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pandas_datareader as web
import warnings
!pip install fbprophet
import fbprophet
```

Now let’s read and look at the data we are work I with:

```
from google.colab import files
uploaded = files.upload()
data = pd.read_csv("GOOG.csv")
data.head()
```

Before moving forward, let’s visualize the data so that we could get some better insights into the data we will work on:

```
plt.style.use("fivethirtyeight")
plt.figure(figsize=(16,8))
plt.title("Google Closing Stock Price")
plt.plot(data["Close"])
plt.xlabel("Date", fontsize=18)
plt.ylabel("Close Price USD ($)", fontsize=18)
plt.show()
```

Only two features are needed from the dataset that is Date and Close Prices. So let’s prepare the data for our model:

```
data = data[["Date","Close"]]
data = data.rename(columns = {"Date":"ds","Close":"y"})
data.head()
```

Now let’s fit the data to the Facebook Prophet model for stock price prediction of Google:

```
from fbprophet import Prophet
m = Prophet(daily_seasonality=True)
m.fit(data)
```

We have successfully fit the data to the Facebook Prophet model. Now let’s have a look at the stock price prediction made by the model:

```
future = m.make_future_dataframe(periods=365)
predictions=m.predict(future)
m.plot(predictions)
plt.title("Prediction of GOOGLE Stock Price")
plt.xlabel("Date")
plt.ylabel("Closing Stock Price")
plt.show()
```

Now let’s have a look at the seasonal affects on this prediction that is made by our model:

`m.plot_components(predictions) plt.show()`

**Also, Read – What is Big Data?**

I hope you liked this article on Stock Price Prediction using the Facebook Prophet model. Feel free to ask your valuable questions in the comments section below. You can also follow me on **Medium** to learn every topic of Machine Learning.

**Also, Read – Object-Oriented Programming for Machine Learning.**