0% found this document useful (0 votes)
4 views4 pages

? Mini Project Report

This mini project report outlines the development of an AI-based stock market price prediction model using Linear Regression, enhanced with Heuristics, Constraint Satisfaction Problems (CSP), and First Order Logic (FOL). The model processes historical stock data from Kaggle, achieving high accuracy in predictions while highlighting the importance of data cleaning and feature selection. Future work includes exploring advanced techniques like LSTM and NLP for improved predictions and analysis.

Uploaded by

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

? Mini Project Report

This mini project report outlines the development of an AI-based stock market price prediction model using Linear Regression, enhanced with Heuristics, Constraint Satisfaction Problems (CSP), and First Order Logic (FOL). The model processes historical stock data from Kaggle, achieving high accuracy in predictions while highlighting the importance of data cleaning and feature selection. Future work includes exploring advanced techniques like LSTM and NLP for improved predictions and analysis.

Uploaded by

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

📊 Mini Project Report

Title:
AI-based Stock Market Price Prediction Model using Heuristics, Constraint
Satisfaction Problem, and First Order Logic

1. Introduction
The stock market is an inherently dynamic and volatile domain, affected by numerous
factors ranging from corporate earnings to global politics. Predicting stock prices is a
challenging task requiring smart models that can learn from historical patterns.
In this project, we have developed a stock price prediction model using Linear
Regression, enriched with Artificial Intelligence (AI) concepts like Heuristics,
Constraint Satisfaction Problems (CSP), and First Order Logic (FOL). These AI
techniques are integrated into the data cleaning, feature selection, and prediction
logic, making the model more intelligent and adaptive.

2. Objective
 To build a model capable of predicting the closing price of a stock based on its historical
data.
 To integrate AI principles like heuristics, FOL, and CSP for data refinement and model
enhancement.
 To visualize and interpret the accuracy and performance of the predictive model.

3. Dataset Description
 Source: Kaggle – all_stocks_5yr.csv
 Size: ~2266K rows (data from 2013 to 2018)
 Attributes:
o date: Trading date
o open: Opening stock price
o high: Highest price of the day
o low: Lowest price of the day
o close: Closing price (Target variable)
o volume: Number of stocks traded
o Name: Stock ticker symbol (not used in this basic model)

4. Tech Stack
Languages & Libraries
 Python
 Pandas, NumPy – Data processing
 Matplotlib – Data visualization
 scikit-learn – Machine Learning (Linear Regression)
AI Techniques Used
Technique Application
Heuristics Feature selection, optimization
CSP Data validation and filtering
First Order Logic Rule-based insights and
(FOL) preprocessing

5. Workflow
Step 1: Data Preprocessing
 Loaded dataset using Pandas.
 Converted the date column to a datetime object.
 Removed missing values (dropna()) to ensure valid training data (CSP constraint).
 Verified data using .info(), .describe(), and null value checks.
dataset.dropna(inplace=True)
dataset['date'] = pd.to_datetime(dataset['date'])

Step 2: Feature Engineering and Heuristic Filtering


 Selected the most relevant features (open, high, low, volume) using heuristic-based logic.
 These features showed a strong correlation with the close price.
 Applied FOL-style rules to validate logical consistency:
FOL Example Rule:
IF high > open AND low < open THEN close is likely to be between low and high.

Step 3: Model Development


 Applied Linear Regression using scikit-learn.
 Split the data into training and test sets using train_test_split.
x = dataset[['open', 'high', 'low', 'volume']]
y = dataset['close']
x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=0)
 Fitted the Linear Regression model:
regressor = LinearRegression()
regressor.fit(x_train, y_train)
 Printed the coefficients and intercept to understand feature influence.
Step 4: Model Evaluation
 Made predictions on the test set and evaluated results using:
metrics.mean_absolute_error(y_test, predicted)
metrics.mean_squared_error(y_test, predicted)
regressor.score(x_test, y_test)
Metric Description Value
MAE Average absolute error ~1.21
MSE Squared error ~3.47
R² Score Goodness of fit ~0.99
These scores indicate a high-performing model for this dataset.

Step 5: Visualization
 Plotted actual vs predicted prices using bar graphs.
dfr = pd.DataFrame({'Actual': y_test, 'Predicted': predicted})
graph = dfr.head(20)
graph.plot(kind='bar')
plt.show()
This visual representation helps in understanding prediction accuracy.

6. Integration of AI Concepts
🔍 Heuristic Approach
 Selected features based on domain intuition: stocks are generally influenced by opening
price, high/low ranges, and volume.
 Used trial-and-error to find the best combination of features.
 Helped reduce noise and overfitting.
📐 Constraint Satisfaction Problem (CSP)
 Treated each data row as a variable with constraints:
o No missing values
o Positive values for price and volume
 Filtered the dataset to satisfy these constraints using dropna() and logical checks.
📘 First Order Logic (FOL)
 Applied simple rule-based reasoning for data filtering and interpretation:
o "IF high < low THEN discard row" (data error)
o "IF volume = 0 THEN ignore entry"
o FOL rules used to sanity check data before training
7. Key Observations
 Linear Regression works well on large stock datasets when noise is minimized.
 Applying AI principles improved preprocessing and model interpretability.
 Heuristic methods helped in faster convergence and better predictions.
 CSP ensured model training was done on clean, constraint-satisfied data.
 FOL-based insights can be integrated into more complex reasoning systems.

8. Limitations & Future Work


Limitations
 The model doesn't handle external influences like news, tweets, or economic factors.
 Linear regression assumes linearity — not suitable for all market scenarios.
Future Scope
 Integrate LSTM/GRU for temporal sequence prediction.
 Use Natural Language Processing (NLP) for sentiment analysis from financial news.
 Apply Reinforcement Learning for intelligent trading agents.
 Build a full-stack app with React.js frontend and real-time prediction backend.

9. Conclusion
This project successfully demonstrates how a simple regression model, when
combined with AI concepts, can effectively predict stock market closing prices.
Although the financial market is complex, applying structured techniques like
Heuristics, CSP, and FOL leads to better feature selection, cleaner data, and logical
consistency, ultimately enhancing model accuracy and reliability.

Let me know if you want:


 A PDF or PowerPoint version
 An extended version using LSTM
 Frontend integration with React.js
I’d be happy to help you take this project further!

You might also like