Kaylah072001 commited on
Commit
cf2e5d3
·
verified ·
1 Parent(s): 457a565

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +55 -59
README.md CHANGED
@@ -1,83 +1,79 @@
1
- ---
2
- # For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
3
- # Doc / guide: https://huggingface.co/docs/hub/model-cards
4
- {}
5
- ---
6
-
7
- # Model Card for Model ID
8
-
9
- The Hybrid Image-Numerical Stock Prediction Model is a multi-input neural network designed to predict binary stock price movements (up/down) based on historical chart images and technical indicators. It processes both image data (stock charts) and numerical data (technical indicators like RSI, MACD, Bollinger Bands, ATR, and OBV) to make predictions.
10
-
11
-
12
- This modelcard aims to be a base template for new models. It has been generated using [this raw template](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md?plain=1).
13
-
14
- ## Uses
15
-
16
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
17
-
18
- ### Direct Use
19
-
20
- The model can be used for predicting short-term stock price movements based on historical data. It is intended for use in financial analysis when combined with other tools and strategies.
21
-
22
- ## Bias, Risks, and Limitations
23
-
24
- The model may exhibit biases based on the training dataset's characteristics. It may not perform well during sudden market shifts caused by external factors. Users should be cautious about over-reliance on the model's predictions without additional analysis.
25
-
26
- ### Recommendations
27
-
28
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
29
 
30
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
31
 
32
- ## How to Get Started with the Model
33
 
 
34
 
 
 
35
 
36
- ## Training Details
37
-
38
- ### Training Data
39
-
40
- The model was trained on the Kaylah072001/Stock_Graphs_Dataset, which includes stock chart images and corresponding price data. Technical indicators were extracted using the ta library.
41
-
42
-
43
-
44
- ### Training Procedure
45
-
46
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
47
-
48
- #### Preprocessing [optional]
49
 
50
- Image data was rescaled to a range of 0–1 and augmented using rotation, shift, zoom, and flip techniques. Numerical features were extracted dynamically during training using technical indicator calculations.
51
 
 
 
 
 
52
 
53
- #### Training Hyperparameters
 
54
 
55
- - **Training regime:** Training regime: Mixed precision (fp32)
56
- Optimizer: Adam
57
- Loss function: Binary crossentropy
58
- Metrics: Accuracy, AUC-ROC
59
- Cross-validation: 5-fold stratified k-fold
60
 
 
61
 
 
 
 
 
 
62
 
63
- ### Testing Data, Factors & Metrics
64
 
65
- #### Testing Data
 
 
 
66
 
67
- <!-- This should link to a Dataset Card if possible. -->
68
 
69
- [More Information Needed]
70
 
71
- #### Factors
 
 
 
 
72
 
73
- Performance was evaluated across different market conditions and stock types.
 
 
 
 
 
74
 
75
- [More Information Needed]
 
 
76
 
77
- #### Metrics
78
 
79
- Accuracy
 
 
 
80
 
 
 
 
 
 
 
81
 
 
82
 
 
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
+ # Stock Classification Model
3
 
4
+ This repository contains The Hybrid Image-Numerical Stock Prediction Model is a multi-input neural network designed to predict binary stock price movements (up/down) based on historical chart images and technical indicators. It processes both image data (stock charts) and numerical data (technical indicators like RSI, MACD, Bollinger Bands, ATR, and OBV) to make predictions.
5
 
6
+ ---
7
 
8
+ ## Features 🐾
9
+ - **High Accuracy**: Achieves a **test accuracy of 83.43%**!
10
 
11
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ ## Performance Metrics 📊
14
 
15
+ ### Final Results:
16
+ - **Test Accuracy**: `91.35%`
17
+ - **Validation Accuracy**: `86.89%`
18
+ - **Training Accuracy**: `99.89%`
19
 
20
+ ### Confusion Matrix Visualization 🎯
21
+ ![Confusion Matrix](./mat.png)
22
 
23
+ This confusion matrix gives a detailed view of the classification performance for each Pokémon class. Misclassifications are represented along the off-diagonal cells.
 
 
 
 
24
 
25
+ ---
26
 
27
+ ## Dataset 📂
28
+ - **Source**: Stock graph images from opensource API yfinance.
29
+ - **Structure**:
30
+ - `images/`: Contains all Pokémon images.
31
+ - `pokemon.csv`: Metadata linking each image to its respective Pokémon and class labels.
32
 
33
+ ---
34
 
35
+ ## Model Details 🧠
36
+ - **Architecture**: Fine-tuned **ResNet101**.
37
+ - **Optimizer**: Adam with learning rate scheduling.
38
+ - **Loss Function**: Cross-Entropy Loss.
39
 
40
+ ---
41
 
42
+ ## Usage 🚀
43
 
44
+ ### Loading the Model
45
+ ```python
46
+ import torch
47
+ from tensorflow.keras.models import Model
48
+ import pickle
49
 
50
+ # Load the model
51
+ model = Model(inputs=[img_input, num_input], outputs=output)
52
+ num_features = model.fc.in_features
53
+ model.fc = torch.nn.Linear(num_features, 2)
54
+ model.load_state_dict(torch.load('stock_prediction_model.h5'))
55
+ model.eval()
56
 
57
+ # Load label mapping
58
+ with open('label_mapping.pkl', 'rb') as f:
59
+ label_mapping = pickle.load(f)
60
 
61
+ ```
62
 
63
+ ### Making Predictions
64
+ ```python
65
+ from PIL import Image
66
+ from tensorflow.keras.preprocessing import transforms
67
 
68
+ # Define transforms
69
+ val_transform = transforms.Compose([
70
+ transforms.Resize((224, 224)),
71
+ transforms.ToTensor(),
72
+ transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
73
+ ])
74
 
75
+ ```
76
 
77
+ ---
78
 
79
+ Feel free to explore and use the model. Contributions are welcome! 🙌