|
--- |
|
title: LogisticMap ChaosClassifier |
|
emoji: π |
|
colorFrom: red |
|
colorTo: yellow |
|
sdk: gradio |
|
sdk_version: 5.40.0 |
|
app_file: app.py |
|
pinned: false |
|
short_description: 'Tweak r value generate prediction: stable, periodic, chaotic' |
|
--- |
|
|
|
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference |
|
|
|
|
|
# Chaos Classifier - Experimental Stock Regime Predictor |
|
|
|
> β οΈ **Disclaimer**: This is an experimental project. Results may be inconsistent or overly biased toward "Stable" predictions due to limited return volatility in modern equity markets. Additionally, the app depends on freely available real-time stock data, which can be sparse at certain intervals. Please do not use this tool for financial decisions. |
|
|
|
--- |
|
|
|
## Project Overview |
|
|
|
This project classifies the behavior of stock return sequences into **three dynamical regimes**: |
|
- β
**Stable** |
|
- π **Periodic** |
|
- π **Chaotic** |
|
|
|
Inspired by logistic map simulations and chaos theory, we train a Convolutional Neural Network (CNN) to recognize patterns in **log return sequences** of financial instruments and classify them accordingly. |
|
|
|
The app runs on **Gradio** and uses **Yahoo Finance (via yfinance)** to fetch real-world data for tickers like `AAPL`, `TSLA`, etc. |
|
|
|
--- |
|
|
|
## Model Details |
|
|
|
- **Model Type**: CNN-based classifier |
|
- **Input**: A sequence of 100 log returns (normalized) |
|
- **Output**: One of the 3 regimes |
|
- **Framework**: PyTorch |
|
- **Scaler**: StandardScaler from `scikit-learn` |
|
|
|
--- |
|
|
|
## Known Limitations |
|
|
|
- **Sparse Market Volatility**: Real-world equities often yield return sequences classified as βStable.β |
|
- **Data Gaps**: Some tickers or intervals (like 30m, 1h) may not return enough data points. |
|
- **Zero Padding**: While previously implemented, padding was removed to avoid misleading predictions. |
|
- **No Financial Use**: This is strictly for educational and exploratory purposes. |
|
|
|
--- |
|
|
|
## How It Works |
|
|
|
### Tab 1: Simulated Chaos |
|
|
|
- Visualizes and classifies simulated return sequences using the logistic map. |
|
- Useful for validating the model on artificially controlled chaos. |
|
|
|
### Tab 2: Real Market Data |
|
|
|
- Input a stock ticker (e.g., `AAPL`) |
|
- The app: |
|
1. Downloads price data |
|
2. Computes log returns |
|
3. Feeds into the CNN model |
|
4. Returns the predicted regime and a plot of price + returns |
|
|
|
--- |
|
|
|
## Dependencies |
|
|
|
See `requirements.txt` for exact package versions. |
|
|
|
```bash |
|
pip install -r requirements.txt |
|
|