Downloads · 30 days
0
mltrev23/gold-price-prediction
gold-price-prediction is a machine learning model from mltrev23. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains two models designed for predicting gold prices, both trained on the mltrev23/gold-price dataset. The models include:
Downloads · 30 days
0
Access
Public
Updated Sep 14, 2024
Repo size
743 KB
Likes
4
Public
Click a slice to open those files.
.pkl743 KB · 99%
From the Hugging Face model README
This repository contains two models designed for predicting gold prices, both trained on the mltrev23/gold-price dataset. The models include:
Both models are designed to handle time series data effectively, capturing temporal dependencies to provide accurate predictions.
gru_gold_price_model.pkllstm_gold_price_model.pklBoth models were trained on the mltrev23/gold-price dataset, which includes historical data on gold prices, potentially augmented with additional financial indicators to enhance predictive performance.
To use these models, first clone this repository and install the required Python packages:
git clone https://huggingface.co/mltrev23/gold-price-prediction
cd gold-price-prediction
pip install -r requirements.txt
The models require the following Python libraries:
pip install numpy
pip install pandas
pip install tensorflow
pip install scikit-learn
You can load the models using the joblib library for scikit-learn or pickle for Python's built-in serialization:
import joblib
# Load the GRU model
gru_model = joblib.load('gru_gold_price_model.pkl')
# Load the LSTM model
lstm_model = joblib.load('lstm_gold_price_model.pkl')
To predict future gold prices using either model, you can follow this approach:
import numpy as np
# Example input data (replace with your actual data)
input_data = np.array([[1790, 1805, 1780]]) # Example sequence: previous gold prices
# Predict using the GRU model
gru_prediction = gru_model.predict(input_data)
# Predict using the LSTM model
lstm_prediction = lstm_model.predict(input_data)
print(f"GRU Prediction: {gru_prediction}")
print(f"LSTM Prediction: {lstm_prediction}")
You can also evaluate the performance of the models using a test set from the same dataset:
from sklearn.metrics import mean_squared_error
# Assuming you have a test set
gru_predictions = gru_model.predict(X_test)
lstm_predictions = lstm_model.predict(X_test)
gru_mse = mean_squared_error(y_test, gru_predictions)
lstm_mse = mean_squared_error(y_test, lstm_predictions)
print(f"GRU Model MSE: {gru_mse}")
print(f"LSTM Model MSE: {lstm_mse}")
Both models can be interpreted by examining their predictions over time and comparing their performance on various test sets. Understanding the impact of different time series inputs on the prediction can provide insights into how each model captures temporal dependencies.
If you wish to contribute to this repository by improving the models, adding new features, or expanding the dataset, feel free to submit a pull request. Please ensure that your code is well-documented and adheres to the existing style.
This project is licensed under the MIT License - see the LICENSE file for details.
If you use these models in your research or project, please cite the dataset and relevant model training methods as follows:
mltrev23/gold-price