View on GitHub

data_analysis_gold_price

This Notebook deals with prediction of gold prices. The data contains features regarding the Gold Price Data.

Gold Price Prediction Using Machine Learning

This Notebook deals with prediction of gold prices. The data contains features regarding the Gold Price Data.

Objectives

ABOUT THE DATA

# Import required libraries
import pandas as pd                                          #Load data & perform basic operations
import numpy as np                                           #Numpy Arrays
import matplotlib.pyplot as plt                              #Matplotlib is a low level graph plotting library in python that serves as a visualization utility.
import seaborn as sns                                        #Seaborn is a library that uses Matplotlib underneath to plot graphs. It will be used to visualize random distributions.
from sklearn.model_selection import train_test_split         #Use to split the original data into training data & test data
from sklearn.ensemble import RandomForestRegressor           #Import Random Forest Regression Model
from sklearn import metrics                                  #Useful for finding performance of model

Data consists of various gold prices for several days in the period of 10 years [Date- MM/DD/YYYY].

Correlation

HeatMap

Checking the distribution of GLD price

Distribution Plot Of GLD Price

Splitting the Features and Target

# axis = 1 (Columns)
# axis = 0 (Rows)
X = gold_price.drop(["Date", "GLD"], axis = 1)
Y = gold_price["GLD"]

Model Training: Random Forest Regressor

# Training the model
# .fit function used to fit our data to this regressive model
regressor.fit(X_train, Y_train)

R scored error: 0.98

Compare the Actual Values & Predicted Values in a Plot

Actaul Values vs Predicted Values