Gold Price Prediction

# The main aimof this project is to challenge the prediction of future adjusted closing price of GOLD
import pandas as pd
df = pd.read_csv('FINAL_USO.csv')
df.head()

To get dataset Click Here


y = df['Adj Close']

#We will start out by selecting features gold ETF features
gold_features = ['Open', 'High', 'Low', 'Volume']
X = df[gold_features]
X.head()
img

from sklearn.linear_model import LinearRegression
# Define Model 
gold_model = LinearRegression()

# Fit Model
gold_model.fit(X, y)

print("Making predictions for the first 5 entries\n")
print(X.head())
print("\nThe predictions are:\n")
print(gold_model.predict(X.head()))
print("\nThe actual values are:\n")
print(y.head())
img

Model Validation

from sklearn.metrics import mean_absolute_error
predicted_adj_close = glod_model.predict(X.head())
print(mean_absolute_error(y.head(),predicted_adj_close))

predicted_adj_close = gold_model.predicted(X)
print(mean_absolute_error(y, predicted_adj_close))

0.24778906753825822
0.21905793913673588


About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





 PreviousNext