0% found this document useful (0 votes)
8 views12 pages

AI Stock Prediction Linear Regression and Q Learning PDF

The document discusses a project that combines linear regression and Q-learning for stock price prediction using OHLV data. It details the processes of data normalization, model training, and the mechanics of Q-learning in trading decisions. Future enhancements include the integration of sentiment analysis and deep learning for improved prediction accuracy.
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)
8 views12 pages

AI Stock Prediction Linear Regression and Q Learning PDF

The document discusses a project that combines linear regression and Q-learning for stock price prediction using OHLV data. It details the processes of data normalization, model training, and the mechanics of Q-learning in trading decisions. Future enhancements include the integration of sentiment analysis and deep learning for improved prediction accuracy.
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/ 12

AI Stock Price Prediction: Linear

Regression & Q-Learning


Predicting stock prices using machine learning techniques combining
linear regression and reinforcement learning. We analyze Open, High, Low,
Volume (OHLV) data with model normalization for improved accuracy.

Group Members:

Syed Abdullah Hassan


M.Abdur Rafay
Moin Ud Din
Implementation in AI Stock
Prediction Project
Data processing
Cleaning and normalization of OHLV data for model input.

Features
Closing price prediction and recommended actions

Model Training & Testing


Training linear regression and Q-learning models and
backtesting results.

Live Demo
20 year Data Set From YFinance
Introduction to Linear Regression
Linear regression models relationships between variables. Example: Predicting stock price (y) based on Open, High, Low,
Equation: y = w1x1+ w2x2+w3x3 +w4x4+ b extended for Volume (x), establishing a clear predictive trend.
multiple variables.

Its goal is to find the best-fit line that minimizes prediction


error.
Gradient Descent: Optimizing
Linear Regression
1 Iterative optimization 2 Update parameters
Minimizes the cost function Calculate gradient, adjust
like Mean Squared Error weights (w1,w2,w3,w4) and
step-by-step. intercept (b), and repeat.

3 Learning rate
Controls step size; balance between overshooting and slow
convergence.
Data Normalization: Scaling for
Accuracy
Why normalize?
Ensures variables on different
scales do not bias prediction
models.

Z-score Standardization
Centers data around mean 0 with a standard deviation of 1.
Q-Learning: Reinforcement Learning for Trading
Learns optimal trading policies by trial and error using rewards. Q-table stores expected reward values for state-action pairs,
guiding decisions.

• States defined by only OHLV


• Actions: Buy, Sell, Hold
• Rewards based on profit or loss from trades
Q-Learning Algorithm Mechanics

1 Q-table Initialization 2 Exploration vs


Start with random estimates
Exploitation
for all state-action pairs. Balance between trying new
actions and selecting best
known actions.

3 Q-value update
Update based on reward and estimated future rewards with learning
and discount rates.
Combining Linear Regression & Q-Learning
Linear regression predicts short-term price based on OHLV Example: Predicted price rise triggers Q-learning to assess buy
data. decision with risk tolerance.

Q-Learning uses these predictions as input for strategic trading


decisions.
Conclusion and Future Directions

Combining linear regression and Q-learning enhances AI stock prediction.

Normalization and gradient descent optimize model performance


significantly.

Future plans include adding sentiment analysis and deep learning models.

Innovation continues by leveraging more alternative data sources for


better predictions.

You might also like