Skip to content
C

Problem 2: Compare Trees of Different Depths

Easypython

Problem Description

Write a Python program that trains Decision Trees with max_depth=1, max_depth=3, and no depth limit on the same dataset, then compares their predictions on the same new data point.

Input

A labeled dataset and one new data point.

Output

The prediction from each of the three trees.

Constraints

  • At least 8 labeled training examples.

Example Input

text
X=[[1],[2],[3],[7],[8],[9],[10],[11]], y=[0,0,0,1,1,1,1,1], new=[[6]]

Example Output

text
max_depth=1: [1] max_depth=3: [0] No limit: [0]

Concepts Covered

max_depth parameter, comparing model configurations.

Input (stdin)

Output

Run your code to see output here...