0% found this document useful (0 votes)
14 views6 pages

Ba Term 2 Project

BA TERM 2 PROJECT

Uploaded by

o17847999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

Ba Term 2 Project

BA TERM 2 PROJECT

Uploaded by

o17847999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Chapter 0: Abstract of the Project

This project focuses on applying neural networks for predicting stock prices using historical financial
data. The approach involves building and evaluating a feedforward neural network model with
historical stock prices as input features. The dataset includes key indicators such as opening price,
high, low, close, and volume. By utilizing neural network techniques, this project aims to predict the
adjusted closing price of the stock while evaluating the model's performance through key metrics such
as mean squared error (MSE) and R-squared. The overall goal is to provide a robust and accurate
model that offers valuable insights into stock price movements.

Chapter 1: Introduction
Predicting stock prices has long been a significant challenge in finance due to the inherent volatility of
the market and the multitude of factors that influence it. Machine learning techniques, particularly
neural networks, provide the capability to capture nonlinear relationships and hidden patterns in
historical data that traditional methods may fail to recognize. This project demonstrates the feasibility
and effectiveness of implementing a neural network using Keras to predict stock prices. By leveraging
historical market data, this project illustrates the ability of neural networks to model financial trends
and make accurate predictions.

Chapter 2: Problem Statement


The primary goal of this project is to develop a neural network model capable of predicting the
adjusted close price of a stock based on historical data. To achieve this, the project focuses on several
objectives:
1. Collecting and preprocessing relevant stock price data.
2. Designing and training a neural network model utilizing input features derived from historical
stock prices.
3. Evaluating the model’s performance using comprehensive metrics such as mean squared error
(MSE) and R-squared to assess its predictive accuracy and reliability.
4. Highlighting the strengths and limitations of the neural network model in financial prediction
tasks.

Chapter 3: Data Collection


The dataset employed in this project was sourced from historical stock market data and includes the
following key features:
• Date: The trading date for the stock.
• Open: The stock’s opening price on the given date.
• High: The highest price the stock reached during the trading session.
• Low: The lowest price the stock reached during the trading session.
• Close: The final trading price of the stock on the given date.
• Adj Close: The adjusted closing price, which accounts for factors like dividends and stock
splits (target variable).
• Volume: The total number of shares traded during the session.
Preprocessing involved several essential steps, including handling missing values, normalizing
features using MinMaxScaler to ensure consistency, and splitting the dataset into training and testing
subsets to facilitate effective model evaluation.

Chapter 4: Methodology
1. Data Preprocessing:
o The numerical features (Open, High, Low, Close, and Volume) were normalized using
MinMaxScaler to scale them to a range between 0 and 1.
o The target variable (Adj Close) was also scaled using the same approach to ensure
compatibility with the neural network’s training requirements.
o The dataset was divided into training (80%) and testing (20%) subsets to enable the
evaluation of the model’s generalization performance.
2. Model Design:
o The model architecture was implemented as a sequential feedforward neural network
with the following structure:
▪ Input Layer: Accepts 5 features as input.
▪ Hidden Layers:
▪ A first hidden layer comprising 64 neurons with ReLU activation to
capture complex patterns.
▪ A second hidden layer with 32 neurons and ReLU activation to refine
the model’s predictive capabilities.
▪ Output Layer: A single neuron to produce a continuous output for
regression.
o Compilation involved the following settings:
▪ Loss Function: Mean Squared Error (MSE) to measure prediction error.
▪ Optimizer: Adam optimizer for efficient learning.
▪ Metrics: Mean Absolute Error (MAE) to track prediction accuracy.
3. Model Training:
o The model was trained over 50 epochs with a batch size of 32, allowing it to
iteratively learn from the training data.
o Validation data was employed during training to monitor and prevent overfitting,
ensuring the model’s generalization to unseen data.
4. Evaluation:
o Predictions generated by the model were evaluated on the test set using MSE and R-
squared metrics to gauge accuracy and fit quality.

Chapter 5: Experiment and Results


1. Techniques Used:
o MinMaxScaler for data normalization.
o Sequential neural network design using Keras for regression tasks.
o Python libraries such as Keras and Scikit-learn for training and evaluation.
2. Results:
o Mean Squared Error (MSE): 1.0822e-05, indicating minimal error in predictions.
o R-squared (R²): 0.9998, showcasing the model’s near-perfect ability to explain
variance in the target variable.
3. Detailed Analysis of Results:
o Training vs Validation Loss:
▪ The model demonstrated consistent learning over 50 epochs, with both
training and validation losses steadily decreasing.
▪ A close alignment between training and validation loss curves indicates that
the model is neither underfitting nor overfitting the data, suggesting effective
generalization.
o Residual Distribution:
▪ The residuals (differences between true and predicted values) are
predominantly centered around zero, which highlights the accuracy of the
model’s predictions.
▪ The narrow spread of residuals indicates a minimal error margin and
confirms the effectiveness of the model in capturing key patterns in the data.
4. Graphs and Visualizations:
o Adjusted Close Price Over Time:

This graph provides a visual representation of the adjusted close price trends over time, highlighting
significant peaks and troughs that the neural network uses to learn and predict future prices.

o Training vs Validation Loss:


This graph illustrates the model’s learning process over 50 epochs, showing a steady decrease in both
training and validation loss. The close alignment between the two loss curves indicates effective
learning without overfitting.

o Residual Plot:

The residual plot showcases the differences between true and predicted values. The residuals are
predominantly centered around zero, demonstrating that the model’s predictions are both accurate and
unbiased.

Chapter 6: Summary and Conclusion


This project effectively demonstrated the application of neural networks in the prediction of stock
prices using historical financial data. The results highlight the model’s capability to make highly
accurate predictions, achieving an MSE of 1.0822e-05 and an R-squared value of 0.9998.
Key Insights:
• Proper data preprocessing, including normalization, was crucial to achieving accurate and
reliable predictions.
• The neural network’s architecture and training process proved highly effective in modeling
the complexities of financial data.
Future Work:
• Incorporate additional features such as economic indicators, market sentiment data, or
macroeconomic variables to further enhance the model’s predictive capabilities.
• Experiment with more advanced neural network architectures, such as Long Short-Term
Memory (LSTM) networks, to capture temporal dependencies in stock price data.
• Perform hyperparameter tuning to optimize the model for different financial datasets.
This study underscores the potential of neural networks in financial modeling, offering a robust
approach to tackling the challenges of stock price prediction with high precision.

You might also like