Machine learning sounds technical, but the core idea fits on one picture. By the end of this lesson, you'll know what training and testing mean. And you'll see why a model can shine on old data and fail on new data. You'll also see why more settings raise the risk of fooling yourself.
1 of 8
What you'll learn
- Tell training from testing. Training fits past examples. Testing scores unseen ones.
- Compare the two scores. A big gap means the settings fit noise.
- Keep test data apart. Checking against it many times turns it into training data.
- Hunt for leaks first. A score that looks too good may use future values.
- Look past one score. Costs, move size and sample size come next.
Exercise
- Draw ten made-up dots on paper and split them: seven for training, three for testing.
- Draw a straight line and a wiggly line through the seven.
- Then see which line lands closer to the three you held back.
Quick check
1. Which score says something about new data?
2. A model scores 95% in training and 51% in testing. What does the gap suggest?
3. What does adding more settings to a model do?
0 of 3 answered.
Finished this lesson?
Tick it off and keep your place
Read the full notes
Machine learning means a program adjusts its settings to fit past examples (training), then is scored on examples it never saw (testing). More settings can fit more noise, so a big gap between the training and test scores is the warning sign, and a leak from the future can make any score look too good.
- A kind of AI where a program adjusts its own settings to fit examples from past data, then is used on data it hasn’t seen.More in the glossary: a program adjusts its own settings to fit examples. Each example is what was known at one moment and what happened next.
- Training: adjusting the settings to fit the examples. Testing: scoring it on examples it never saw. The same idea as In-sample and out-of-sample data.
- Made-up picture: a straight line (2 settings) misses most training dots by a little; a wiggly line through every dot is perfect on training data and worse on new dots. That's Tuning a strategy’s rules so closely to one stretch of past prices that they describe that stretch’s quirks more than anything that carries on.More in the glossary: What overfitting is.
- More settings fit more of the The small, random ups and downs in price that don’t follow any pattern that repeats. A rule tuned to noise fits the past but not new prices.More in the glossary. Warning sign: a big gap between training and test scores. Checking and changing against the test data many times turns it into training data.
- Leaks: a value not yet known at that moment (Look-ahead bias), or test data mixed into training. A test score that looks too good is a reason to look for a leak first.
- Made-up: training 900 of 1,000 (90%), test 130 of 250 (52%). The gap says noise; 52% alone ignores costs and move size, and 250 examples leave room for chance (Sample size). Answer to the drill: 56%. Guide: AI and machine learning in trading.
Worked example
Made-up numbersTraining score versus test score
Made-up numbers · up-or-down prediction for the next hour
- Training: 900 ÷ 1,000 = 90%.
- Test: 130 ÷ 250 = 52%.
- The big gap points to noise learned in training.
Only the test score speaks about new data, and even then costs, move size and sample size come next.
Your turn
DrillMade-up numbers · a model is right on 140 of 250 test examples
Trading is risky. You can lose money, whatever method found the rules. Test results are hypothetical, and a test can’t tell you what will happen next. This lesson explains how things work. It isn’t advice.