The results you've shared provide a comprehensive evaluation of your Random Forest model in predicting profitable stocks. Here's an analysis of the findings:
1. Classification Report with Default Threshold (0.5):
Metrics:
Analysis:
- Accuracy is solid at 81%, indicating the model correctly predicts 81% of the instances.
- Precision for Class 0 is higher than for Class 1, suggesting the model is better at correctly identifying non-profitable stocks.
- Recall for Class 1 is 0.78, meaning the model captures 78% of the actual profitable stocks.
- The F1-Score balances precision and recall, showing overall effectiveness for both classes.
2. Classification Report with Optimal Threshold (0.47):
After adjusting the threshold to 0.47, the model's metrics slightly change:
Metrics:
-
Class 0:
- Precision: 0.88
- Recall: 0.79
- F1-Score: 0.83
-
Class 1:
- Precision: 0.69
- Recall: 0.81
- F1-Score: 0.75
-
Overall:
- Accuracy: 0.80
- Macro Average Precision: 0.79
- Macro Average Recall: 0.80
- Macro Average F1-Score: 0.79
Analysis:
- Recall for Class 1 increased from 0.78 to 0.81, meaning the model now identifies a higher proportion of actual profitable stocks.
- Precision for Class 1 decreased slightly from 0.71 to 0.69, indicating more false positives.
- The F1-Score for Class 1 remains the same, suggesting a balance between precision and recall is maintained.
- Overall accuracy decreased marginally to 80%.
Implications of Threshold Adjustment:
- Lowering the threshold increases the sensitivity of the model to positive instances (profitable stocks).
- This adjustment is beneficial if the priority is to capture more profitable stocks at the expense of misclassifying some non-profitable ones.
3. Cross-Validated AUC Scores for Random Forest:
AUC Scores:
- Fold 1: 0.9042
- Fold 2: 0.8982
- Fold 3: 0.9130
- Fold 4: 0.9018
- Fold 5: 0.9015
**Mean AUC: 0.90
Analysis:
- The Area Under the Curve (AUC) is consistently around 0.90, indicating excellent model performance in distinguishing between the two classes.
- High AUC values signify that the model has a strong ability to rank positive instances higher than negative ones.
- The small variance among the folds suggests the model's performance is stable and generalizes well to unseen data.
4. Stocks Predicted to be Profitable:
List of Stocks:
| Symbol | Date | Close | Prediction_Prob |
|---|
| ALKEM.NS | 2024-09-19 | 6136.85 | 0.485000 |
| BALKRISIND.NS | 2024-09-19 | 3090.05 | 0.485000 |
| BSE.NS | 2024-09-19 | 3711.20 | 0.475000 |
| COCHINSHIP.NS | 2024-09-19 | 1678.25 | 0.475000 |
| ... | ... | ... | ... |
| RPOWER.NS | 2024-09-19 | 34.61 | 0.505000 |
Analysis:
- Prediction Probabilities range from 0.475 to 0.515, hovering around the set threshold of 0.47.
- Stocks like MANORG.BO and RPOWER.NS have probabilities slightly above 0.50, indicating higher confidence in their profitability.
- Close Prices vary widely, from low-priced stocks like MANAKCOAT.NS at 63.50 to higher-priced ones like MAZDOCK.NS at 4059.65.
Interpretation:
- The stocks listed are those the model predicts to be profitable based on the features and data provided.
- Since the prediction probabilities are close to the threshold, there's moderate confidence in these predictions.
- It would be prudent to further analyze these stocks using fundamental and technical analysis before making investment decisions.
5. Recommendations and Considerations:
Model Threshold:
- Adjusting the Threshold: Depending on the investment strategy, you might consider adjusting the threshold further.
- Higher Threshold (>0.5): Increases precision but may decrease recall, leading to fewer predicted profitable stocks with higher confidence.
- Lower Threshold (<0.47): Increases recall but may decrease precision, capturing more profitable stocks but with more false positives.
Business Objectives:
- Risk Tolerance: If the goal is to minimize false positives (avoiding investing in non-profitable stocks), maintain a higher threshold.
- Aggressive Strategy: If the goal is to capture as many profitable stocks as possible, even at the risk of including some non-profitable ones, a lower threshold is acceptable.
Further Model Improvement:
- Feature Importance: Analyze which features are most influential in the model's predictions. This can provide insights into key factors driving stock profitability.
- Ensemble Methods: Consider combining the Random Forest model with other models (e.g., Gradient Boosting) to potentially improve performance.
- Hyperparameter Tuning: Further tuning of the model's hyperparameters (e.g., number of trees, depth) might enhance predictive capability.
Data Considerations:
- Data Quality: Ensure that the data used is up-to-date and accurately reflects the current market conditions.
- Time Frame: The predictions are for stocks as of 2024-09-19, so market changes between now and then could affect outcomes.
Investment Strategy:
- Diversification: Even with model predictions, it's advisable to diversify investments to mitigate risk.
- Due Diligence: Use the model's predictions as a starting point and perform comprehensive analysis on each stock.
Conclusion:
Your Random Forest model demonstrates strong predictive performance, with high AUC scores and reasonable accuracy metrics. By adjusting the classification threshold, you can tailor the model to align with your investment objectives, balancing between precision and recall.
The list of predicted profitable stocks offers potential opportunities, but it's important to conduct further analysis before making investment decisions. Incorporating additional models, refining the current model, and staying informed about market dynamics will enhance the predictive power and reliability of your investment strategy.