Skip to content
CampusEduX

Problem 2: Compare Train vs Test Error for an Overly Complex Model

Easypython
Learn the Concept: Bias-Variance Tradeoff

Problem Description

Write a Python program that trains a very deep Decision Tree (max_depth=20 or no limit) on the same dataset, and compares its training and test error, to observe signs of high variance.

Input

The same dataset split into training and test sets.

Output

Training and test MSE for the deep model.

Constraints

  • Use the same dataset as Problem 1 for direct comparison.

Example Input

text
(The same dataset as Problem 1)

Example Output

text
Train MSE: 0.002 Test MSE: 0.19

Concepts Covered

DecisionTreeRegressor, max_depth, overfitting diagnosis.

Related Problems

  • Problem 1: Compare Train vs Test Error for a Simple Model
    Easy · python
    Solve Problem
  • Problem 3: Plot Train and Test Error Across Increasing Model Complexity
    Easy · python
    Solve Problem
  • Problem 4: Identify the Best max_depth Using Test Error
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...