Skip to content

Commit 2c2342c

Browse files
authored
Merge pull request #1296 from alo7lika/main
Market Trend Classification Model
2 parents 651a3af + f1f0e3e commit 2c2342c

File tree

7 files changed

+1420
-0
lines changed

7 files changed

+1420
-0
lines changed

Classification Models/Market Trend Classification Model/Market Trend Classification Model.ipynb

Lines changed: 471 additions & 0 deletions
Large diffs are not rendered by default.
1.97 MB
Loading
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# 📈 Market Trend Classification Model
2+
3+
<p align="center">
4+
<img src="https://raw.githubusercontent.com/alo7lika/machine-learning-repos/refs/heads/main/Classification%20Models/Market%20Trend%20Classification%20Model/MarketTrend%20Analytics%20-%20Classification%20Model.png" alt="Market Trend Classification Model" width="600"/>
5+
</p>
6+
7+
## 📖 Overview
8+
The Market Trend Classification Model aims to identify different market conditions by analyzing historical stock price data. This project classifies market regimes by utilizing advanced data analysis techniques to aid in informed trading decisions and strategy development.
9+
10+
## 📚 Table of Contents
11+
- [🚀 Problem Statement](#-problem-statement)
12+
- [💡 Proposed Solution](#-proposed-solution)
13+
- [Key Components](#key-components)
14+
- [📦 Installation & Usage](#-installation--usage)
15+
- [⚙️ Alternatives Considered](#-alternatives-considered)
16+
- [📊 Results](#-results)
17+
- [🔍 Conclusion](#-conclusion)
18+
- [🤝 Acknowledgments](#-acknowledgments)
19+
- [📧 Contact](#-contact)
20+
21+
## 🚀 Problem Statement
22+
Accurate Market Trend Classification Model is crucial for investors and traders. Identifying whether the market is in a bull, bear, or neutral phase can significantly influence trading strategies and risk management.
23+
24+
## 💡 Proposed Solution
25+
This project employs clustering algorithms to categorize market regimes based on features derived from stock price movements.
26+
27+
### Key Components
28+
| Component | Description |
29+
|-------------------------|--------------------------------------------------------------|
30+
| **Data Collection** | Historical stock data is sourced from Yahoo Finance. |
31+
| **Data Preprocessing** | Calculating daily returns, moving averages, and volatility. |
32+
| **Feature Engineering** | Normalizing data for effective clustering. |
33+
| **Clustering** | K-Means clustering is used to classify market regimes. |
34+
| **Model Validation** | Evaluating the effectiveness of detected regimes. |
35+
36+
## 📦 Installation & Usage
37+
To get started, ensure you have Python and the following libraries installed:
38+
39+
| Library | Installation Command |
40+
|------------------|------------------------------------------|
41+
| **Pandas** | `pip install pandas` |
42+
| **NumPy** | `pip install numpy` |
43+
| **Matplotlib** | `pip install matplotlib` |
44+
| **Scikit-learn** | `pip install scikit-learn` |
45+
| **yfinance** | `pip install yfinance` |
46+
47+
## ⚙️ Alternatives Considered
48+
Several alternative approaches were evaluated, including:
49+
50+
| Alternative Approach | Description |
51+
|----------------------------|--------------------------------------------------|
52+
| **Traditional Machine Learning** | Algorithms like SVM and k-NN were considered; effective for smaller datasets but struggled with complexity. |
53+
54+
## 📊 Results
55+
The model aims to classify market regimes accurately, providing valuable insights for trading strategies.
56+
57+
## 🔍 Conclusion
58+
This project demonstrates the significance of time series analysis and clustering techniques in financial market analysis. The identified regimes can enhance traders' and investors' decision-making processes.
59+
60+
## 🤝 Acknowledgments
61+
- **Dataset:** Yahoo Finance
62+
- **Frameworks:** Pandas, NumPy, Matplotlib, Scikit-learn, yfinance
63+
64+
## 📧 Contact
65+
For any inquiries or contributions, feel free to reach out:
66+
67+
| Name | Email | GitHub |
68+
|--------------------|-----------------------------|---------------------|
69+
| Alolika Bhowmik | [email protected] | [alo7lika](https://github.com/alo7lika) |

Prediction Models/ClusterLogic Model/ClusterLogic Model.ipynb

Lines changed: 571 additions & 0 deletions
Large diffs are not rendered by default.
711 KB
Loading
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
CustomerID,Genre,Age,Annual Income (k$),Spending Score (1-100)
2+
0001,Male,19,15,39
3+
0002,Male,21,15,81
4+
0003,Female,20,16,6
5+
0004,Female,23,16,77
6+
0005,Female,31,17,40
7+
0006,Female,22,17,76
8+
0007,Female,35,18,6
9+
0008,Female,23,18,94
10+
0009,Male,64,19,3
11+
0010,Female,30,19,72
12+
0011,Male,67,19,14
13+
0012,Female,35,19,99
14+
0013,Female,58,20,15
15+
0014,Female,24,20,77
16+
0015,Male,37,20,13
17+
0016,Male,22,20,79
18+
0017,Female,35,21,35
19+
0018,Male,20,21,66
20+
0019,Male,52,23,29
21+
0020,Female,35,23,98
22+
0021,Male,35,24,35
23+
0022,Male,25,24,73
24+
0023,Female,46,25,5
25+
0024,Male,31,25,73
26+
0025,Female,54,28,14
27+
0026,Male,29,28,82
28+
0027,Female,45,28,32
29+
0028,Male,35,28,61
30+
0029,Female,40,29,31
31+
0030,Female,23,29,87
32+
0031,Male,60,30,4
33+
0032,Female,21,30,73
34+
0033,Male,53,33,4
35+
0034,Male,18,33,92
36+
0035,Female,49,33,14
37+
0036,Female,21,33,81
38+
0037,Female,42,34,17
39+
0038,Female,30,34,73
40+
0039,Female,36,37,26
41+
0040,Female,20,37,75
42+
0041,Female,65,38,35
43+
0042,Male,24,38,92
44+
0043,Male,48,39,36
45+
0044,Female,31,39,61
46+
0045,Female,49,39,28
47+
0046,Female,24,39,65
48+
0047,Female,50,40,55
49+
0048,Female,27,40,47
50+
0049,Female,29,40,42
51+
0050,Female,31,40,42
52+
0051,Female,49,42,52
53+
0052,Male,33,42,60
54+
0053,Female,31,43,54
55+
0054,Male,59,43,60
56+
0055,Female,50,43,45
57+
0056,Male,47,43,41
58+
0057,Female,51,44,50
59+
0058,Male,69,44,46
60+
0059,Female,27,46,51
61+
0060,Male,53,46,46
62+
0061,Male,70,46,56
63+
0062,Male,19,46,55
64+
0063,Female,67,47,52
65+
0064,Female,54,47,59
66+
0065,Male,63,48,51
67+
0066,Male,18,48,59
68+
0067,Female,43,48,50
69+
0068,Female,68,48,48
70+
0069,Male,19,48,59
71+
0070,Female,32,48,47
72+
0071,Male,70,49,55
73+
0072,Female,47,49,42
74+
0073,Female,60,50,49
75+
0074,Female,60,50,56
76+
0075,Male,59,54,47
77+
0076,Male,26,54,54
78+
0077,Female,45,54,53
79+
0078,Male,40,54,48
80+
0079,Female,23,54,52
81+
0080,Female,49,54,42
82+
0081,Male,57,54,51
83+
0082,Male,38,54,55
84+
0083,Male,67,54,41
85+
0084,Female,46,54,44
86+
0085,Female,21,54,57
87+
0086,Male,48,54,46
88+
0087,Female,55,57,58
89+
0088,Female,22,57,55
90+
0089,Female,34,58,60
91+
0090,Female,50,58,46
92+
0091,Female,68,59,55
93+
0092,Male,18,59,41
94+
0093,Male,48,60,49
95+
0094,Female,40,60,40
96+
0095,Female,32,60,42
97+
0096,Male,24,60,52
98+
0097,Female,47,60,47
99+
0098,Female,27,60,50
100+
0099,Male,48,61,42
101+
0100,Male,20,61,49
102+
0101,Female,23,62,41
103+
0102,Female,49,62,48
104+
0103,Male,67,62,59
105+
0104,Male,26,62,55
106+
0105,Male,49,62,56
107+
0106,Female,21,62,42
108+
0107,Female,66,63,50
109+
0108,Male,54,63,46
110+
0109,Male,68,63,43
111+
0110,Male,66,63,48
112+
0111,Male,65,63,52
113+
0112,Female,19,63,54
114+
0113,Female,38,64,42
115+
0114,Male,19,64,46
116+
0115,Female,18,65,48
117+
0116,Female,19,65,50
118+
0117,Female,63,65,43
119+
0118,Female,49,65,59
120+
0119,Female,51,67,43
121+
0120,Female,50,67,57
122+
0121,Male,27,67,56
123+
0122,Female,38,67,40
124+
0123,Female,40,69,58
125+
0124,Male,39,69,91
126+
0125,Female,23,70,29
127+
0126,Female,31,70,77
128+
0127,Male,43,71,35
129+
0128,Male,40,71,95
130+
0129,Male,59,71,11
131+
0130,Male,38,71,75
132+
0131,Male,47,71,9
133+
0132,Male,39,71,75
134+
0133,Female,25,72,34
135+
0134,Female,31,72,71
136+
0135,Male,20,73,5
137+
0136,Female,29,73,88
138+
0137,Female,44,73,7
139+
0138,Male,32,73,73
140+
0139,Male,19,74,10
141+
0140,Female,35,74,72
142+
0141,Female,57,75,5
143+
0142,Male,32,75,93
144+
0143,Female,28,76,40
145+
0144,Female,32,76,87
146+
0145,Male,25,77,12
147+
0146,Male,28,77,97
148+
0147,Male,48,77,36
149+
0148,Female,32,77,74
150+
0149,Female,34,78,22
151+
0150,Male,34,78,90
152+
0151,Male,43,78,17
153+
0152,Male,39,78,88
154+
0153,Female,44,78,20
155+
0154,Female,38,78,76
156+
0155,Female,47,78,16
157+
0156,Female,27,78,89
158+
0157,Male,37,78,1
159+
0158,Female,30,78,78
160+
0159,Male,34,78,1
161+
0160,Female,30,78,73
162+
0161,Female,56,79,35
163+
0162,Female,29,79,83
164+
0163,Male,19,81,5
165+
0164,Female,31,81,93
166+
0165,Male,50,85,26
167+
0166,Female,36,85,75
168+
0167,Male,42,86,20
169+
0168,Female,33,86,95
170+
0169,Female,36,87,27
171+
0170,Male,32,87,63
172+
0171,Male,40,87,13
173+
0172,Male,28,87,75
174+
0173,Male,36,87,10
175+
0174,Male,36,87,92
176+
0175,Female,52,88,13
177+
0176,Female,30,88,86
178+
0177,Male,58,88,15
179+
0178,Male,27,88,69
180+
0179,Male,59,93,14
181+
0180,Male,35,93,90
182+
0181,Female,37,97,32
183+
0182,Female,32,97,86
184+
0183,Male,46,98,15
185+
0184,Female,29,98,88
186+
0185,Female,41,99,39
187+
0186,Male,30,99,97
188+
0187,Female,54,101,24
189+
0188,Male,28,101,68
190+
0189,Female,41,103,17
191+
0190,Female,36,103,85
192+
0191,Female,34,103,23
193+
0192,Female,32,103,69
194+
0193,Male,33,113,8
195+
0194,Female,38,113,91
196+
0195,Female,47,120,16
197+
0196,Female,35,120,79
198+
0197,Female,45,126,28
199+
0198,Male,32,126,74
200+
0199,Male,32,137,18
201+
0200,Male,30,137,83
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# 🛍️ ClusterLogic Model
2+
3+
<p align="center">
4+
<img src="https://raw.githubusercontent.com/alo7lika/machine-learning-repos/refs/heads/main/Prediction%20Models/ClusterLogic%20Model/ClusterLogic%20Model.png" alt="Customer Clust Segmentation Tool" width="600"/>
5+
</p>
6+
7+
8+
## 📚 Table of Contents
9+
1. [Overview](#-overview)
10+
2. [Features](#-features)
11+
3. [How It Works](#-how-it-works)
12+
4. [Tech Stack](#-tech-stack)
13+
5. [Installation](#-installation)
14+
6. [Usage](#-usage)
15+
7. [Visualizations](#-visualizations)
16+
8. [Machine Learning Models](#-machine-learning-models)
17+
9. [Goals](#-goals)
18+
10. [License](#-license)
19+
11. [Contact](#-contact)
20+
21+
22+
## 📋 Overview
23+
ClusterLogic Model is a powerful customer segmentation tool designed to categorize customers based on their purchasing behavior, preferences, and demographic characteristics. By leveraging advanced data analytics and machine learning techniques, this tool helps businesses:
24+
25+
- 📈 Enhance marketing strategies
26+
- 🧠 Improve customer understanding
27+
- ⚙️ Optimize resource allocation
28+
- 🚀 Drive business growth
29+
- 💡 Foster a data-driven culture
30+
31+
## 🔍 Features
32+
- **Segmentation**: Classifies customers into distinct groups for targeted marketing.
33+
- **Behavioral Insights**: Provides valuable insights into customer preferences and purchasing habits.
34+
- **Visualization**: Interactive charts and graphs for easy interpretation of customer segments.
35+
- **Advanced Metrics**: Incorporates KPIs to measure the impact of different segments on business growth.
36+
37+
## 🧑‍💻 How It Works
38+
1. **Data Collection**: Input customer purchase history, preferences, and demographic data.
39+
2. **Data Preprocessing**: Clean and preprocess the data for machine learning models.
40+
3. **Modeling**: Apply clustering algorithms like K-Means or Hierarchical Clustering to identify customer groups.
41+
4. **Evaluation**: Analyze the results using metrics like silhouette score or within-cluster sum of squares (WCSS).
42+
5. **Visualization**: Visualize the segmentation results using intuitive dashboards.
43+
44+
## 🛠️ Tech Stack
45+
- **Languages**: Python 🐍
46+
- **Libraries**:
47+
- pandas 📊
48+
- numpy 🔢
49+
- scikit-learn 📚
50+
- matplotlib 📉
51+
- seaborn 📈
52+
53+
## 🚀 Getting Started
54+
55+
### Prerequisites
56+
- Python 3.8+
57+
- Jupyter Notebook
58+
- Required libraries in `requirements.txt`
59+
60+
### Installation
61+
Clone this repository:
62+
```bash
63+
git clone https://github.com/yourusername/ClusterLogic.git
64+
cd ClusterLogic
65+
```
66+
Install the necessary dependencies:
67+
68+
```bash
69+
pip install -r requirements.txt
70+
```
71+
### Usage
72+
Run the Jupyter notebook to explore the data and generate customer segments:
73+
74+
```bash
75+
jupyter notebook notebooks/ClusterLogic_Model.ipynb
76+
```
77+
To run the segmentation pipeline as a script:
78+
79+
```bash
80+
python scripts/segment_customers.py
81+
```
82+
83+
## 📊 Visualizations
84+
The tool provides insightful visualizations to help you understand customer clusters and trends, such as:
85+
86+
- 📉 **Purchase trends over time**
87+
- 🧩 **Segmented customer behavior**
88+
- 🗺️ **Demographic distribution maps**
89+
- 🎯 **Targeted marketing groupings**
90+
91+
## 🧠 Machine Learning Models
92+
ClusterLogic Model uses unsupervised learning techniques, primarily focusing on:
93+
94+
- **K-Means Clustering**: For grouping customers into meaningful clusters.
95+
- **Hierarchical Clustering**: To provide more granular segmentation if needed.
96+
97+
## 🏆 Goals
98+
- Improve customer retention and acquisition.
99+
- Maximize marketing campaign efficiency.
100+
- Tailor product recommendations to specific customer segments.
101+
102+
## 🛡️ License
103+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
104+
105+
## 💬 Contact
106+
For more information or queries, feel free to contact the project maintainers at: [[email protected]]
107+
108+

0 commit comments

Comments
 (0)