Python Forum
hello, need help with basic ML
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
hello, need help with basic ML
#1
Bug 
Hello, i take data from alphavantage for chosen share values for choosen day : Date, Open, High, Low, Close, Volume.
And i try to perform simple comparision between Linear Regression and Random Forest approaches to guess next day value.
It looks like it works but graphs are strange:
1. For winning model linear regression i have this: [Image: myplot1.png?rlkey=duven5s81pidp8he9mccdk...mx9n2&dl=0]
i don't understand why i have many y values for each x value, i expected to have only one line for actual and one line for predicted
2. And for next 10 days prediction i have this : [Image: myplot2.png?rlkey=503lm9wcikr6y4pdjooijq...nq57p&dl=0]
first predicted point seems to be ok, but then it goes everywhere and i dont understand why

Could you please help me?
Thank you
.py   ml-002.py (Size: 5.57 KB / Downloads: 1)
likes this post
Reply
#2
Your attempt to compare Linear Regression and Random Forest models for predicting stock values is an excellent project for exploring machine learning techniques. Let’s address the issues you described.

Multiple Y Values for Each X Value:

In your Linear Regression plot, seeing multiple predicted y values for the same x value suggests a problem with how data points are visualized or structured. Check if your dataset contains duplicate x values (dates) due to formatting issues or overlapping data points. Additionally, ensure your plot differentiates between actual and predicted values distinctly—use separate colors or markers for clarity. Ideally, you should see one line for actual values and one for predicted values.

Erratic Predictions in Random Forest:

For Random Forest, the erratic behavior in the next 10-day predictions might result from overfitting or insufficient input features. Random Forest is good for capturing patterns in historical data, but predicting future stock prices often requires additional features, like technical indicators or macroeconomic data, to improve accuracy. Furthermore, ensure you’ve normalized the data appropriately and used a rolling window approach to maintain temporal order during training.

To refine your understanding, enrolling in a machine learning data science course can provide you with the theoretical foundation and practical skills to handle such issues. These courses often cover feature engineering, model evaluation, and optimization techniques crucial for financial forecasting.

In conclusion, validate your data preprocessing steps, carefully tune your models (e.g., hyperparameters for Random Forest), and consider adding relevant features. This approach will likely resolve the anomalies and yield better predictions.
buran write Dec-28-2024, 07:24 AM:
spam link removed
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020