Skip to content
C

Problem 1: Demonstrate Underfitting

Easypython

Problem Description

Write a Python program that trains an overly simple Decision Tree (max_depth=1) on non-linear data, and prints both training and test MSE to demonstrate underfitting.

Input

A dataset with a clear non-linear pattern, split into train/test.

Output

Training and test MSE, both expected to be relatively high.

Constraints

  • At least 20 data points.

Example Input

text
(A dataset following a sine-wave pattern, split into train/test)

Example Output

text
Train MSE: 0.37 Test MSE: 0.40

Concepts Covered

DecisionTreeRegressor, max_depth, underfitting diagnosis.

Input (stdin)

Output

Run your code to see output here...