An open API service indexing awesome lists of open source software.

https://github.com/s1dewalker/markov-model-for-stocks

Markov Model for Stocks in Python. Clustering in Time Series data | Model Development | Stochastic Models
https://github.com/s1dewalker/markov-model-for-stocks

clustering kmeans-clustering machine-learning markov-decision-process markov-model pandas probabilistic-models python sklearn stochastic-processes time-series

Last synced: about 2 months ago
JSON representation

Markov Model for Stocks in Python. Clustering in Time Series data | Model Development | Stochastic Models

Awesome Lists containing this project

README

          

# Markov Model for Stocks
Description

Building Markov Model for Stocks after applying Clustering to Time Series data in Python


## 1. Applying k-means clustering to identify market states
1. Data Preparation
2. Feature Preparation
3. **Check for Multicollinearity**
4. **Normalize** (as some features might dominate due to larger scale) w/ `MinMaxScaler`
5. **Finding Optimal k** w/ WCSS or **elbow method**
6. Perform Silhouette analysis for different k
7. Fit the model and identify the clusters
8. Analyzing clusters
9. Analyzing each cluster


**Finding Optimal k with elbow method**

Description

**Pairwise Feature Relationships by Cluster**

Description


#### [View Clustering](https://github.com/s1dewalker/Markov-Model-for-Stocks/blob/main/py_files/MarkovModel1_Clustering2.ipynb)

Python libraries used: `pandas`, `yfinance`, `sklearn`, `matplotlib`, `seaborn`


## 2. Building Markov Model to create a Transition matrix
1. Get previous state
2. Create Transition State by combining previous and present states
3. Grouping by Transition state and Counting their occurrences
4. Separate the transition state
5. Create Markov transition matrix
6. Convert to row-wise percentages (%)



Description


#### [View Markov Model](https://github.com/s1dewalker/Markov-Model-for-Stocks/blob/main/py_files/MarkovModel2-Building_MarkovModel.ipynb)

Python libraries used: `pandas`