Hold Some Back
A model must be tested on rows it never saw. Split the rows of X at random into a training part and a test part holding a quarter of the rows, using random_state=0 so the split can be repeated. Return the test part.
Example 1
X [[1],[2],[3],[4]]
returns [[3]]
One row of four is held back. With random_state=0 it is the third row.
Constraints
4 <= len(X) <= 40- 1 to 3 columns
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More scikit-learn problems
- Learn Then PredictBeginner
- Names to NumbersBeginner
- Same ScaleBeginner
- Share RightBeginner
- Typical Squared MissBeginner
- What the Model LearnedBeginner
- Zero to OneBeginner
- Curves From LinesEasy