TAYU Academy course material · Machine Learning for Trading
Course Notes
1. Understand the core idea of “Overfitting and regularisation” and explain it in your own words
2. Master this module's focus: Model training and evaluation
3. Complete the assignment on your own and check it against the reference answer
Overfitting can come from a tree being too deep, from too much searching, or from leakage. Regularization cannot fix errors in time splitting. If training performance is high but testing performance is low, first check the workflow, and do not immediately increase the model's complexity.
Random forests and XGBoost, among tree models, are prone to overfitting to noise. Evaluate the model using time series cross-validation (e.g., TimeSeriesSplit with a gap setting); an accuracy exceeding 50% does not necessarily mean profitability, and one must also consider the cost and drawdown after accounting for costs.
Model accuracy is 53%, but the average profit of profitable trades is less than the average loss of losing trades, including the spread, resulting in a negative expected value. Therefore, it is not usable.
First validate data leaks → compare training/validation → limit depth and number of samples → select parameters only in training/validation → test last time.
Training accuracy 100%, test 52%: in what order should you investigate? Why not tune depth directly on the test set?
Check splitting/tagging/repetition first, then look at complexity and baseline. Testing will pollute independent evaluation. Whether 52% is meaningful still needs consideration of class distribution and sample size.
The confusion matrix shows TP=6, FP=4, FN=3, TN=7. The accuracy is 13/20=65%, and the precision is 6/10=60%. The recall is approximately 6/9=66.67%. If the majority class constitutes 70%, an accuracy of 65% is worse than the baseline. Correct classification does not guarantee profitability without incurring costs.
Feature importance is not a causal explanation; if XGBoost cannot be installed, it should indicate optional dependencies not verified, rather than renaming it to random forest.
Install the dependencies listed for this lab in the README first. If a dependency or platform is unavailable, mark the lab as not run; downloading the source is not evidence of running it.
python ml_lab.py1. Use time-series cross-validation
2. Accuracy does not equal profitability
3. Evaluations must include trading costs
Risk warning: leveraged trading in forex, precious metals and similar products carries a high level of risk and you may lose all of your capital, or more. This course is for education only. It is not investment advice and does not promise any return. Example prices and contract specifications are teaching assumptions; always use what your own platform discloses. Past performance and backtests do not indicate future results.
All values, prices, accounts and cases in this course are teaching assumptions; the fixed materials can be reproduced offline. Marking a lesson complete only records your study. It is not a certification, a service approval or a promise of returns. Workbooks and answer files are currently provided in Chinese.
Key Takeaways
Completion records your own study, not verified competence. Exercises use fictional data; no real account or deposit is required.