|
6 | 6 | "source": [
|
7 | 7 | "# \ud83d\udcdd Exercise M5.01\n",
|
8 | 8 | "\n",
|
9 |
| - "In the previous notebook, we showed how a tree with a depth of 1 level was\n", |
10 |
| - "working. The aim of this exercise is to repeat part of the previous experiment\n", |
11 |
| - "for a depth with 2 levels to show how the process of partitioning is repeated\n", |
12 |
| - "over time.\n", |
| 9 | + "In the previous notebook, we showed how a tree with 1 level depth works. The\n", |
| 10 | + "aim of this exercise is to repeat part of the previous experiment for a tree\n", |
| 11 | + "with 2 levels depth to show how such parameter affects the feature space\n", |
| 12 | + "partitioning.\n", |
13 | 13 | "\n",
|
14 |
| - "Before to start, we will:\n", |
15 |
| - "\n", |
16 |
| - "* load the dataset;\n", |
17 |
| - "* split the dataset into training and testing dataset;\n", |
18 |
| - "* define the function to show the classification decision function." |
| 14 | + "We first load the penguins dataset and split it into a training and a testing\n", |
| 15 | + "sets:" |
19 | 16 | ]
|
20 | 17 | },
|
21 | 18 | {
|
|
61 | 58 | "metadata": {},
|
62 | 59 | "source": [
|
63 | 60 | "Create a decision tree classifier with a maximum depth of 2 levels and fit the\n",
|
64 |
| - "training data. Once this classifier trained, plot the data and the decision\n", |
65 |
| - "boundary to see the benefit of increasing the depth. To plot the decision\n", |
66 |
| - "boundary, you should import the class `DecisionBoundaryDisplay` from the\n", |
67 |
| - "module `sklearn.inspection` as shown in the previous course notebook." |
| 61 | + "training data." |
| 62 | + ] |
| 63 | + }, |
| 64 | + { |
| 65 | + "cell_type": "code", |
| 66 | + "execution_count": null, |
| 67 | + "metadata": {}, |
| 68 | + "outputs": [], |
| 69 | + "source": [ |
| 70 | + "# Write your code here." |
| 71 | + ] |
| 72 | + }, |
| 73 | + { |
| 74 | + "cell_type": "markdown", |
| 75 | + "metadata": {}, |
| 76 | + "source": [ |
| 77 | + "Now plot the data and the decision boundary of the trained classifier to see\n", |
| 78 | + "the effect of increasing the depth of the tree.\n", |
| 79 | + "\n", |
| 80 | + "Hint: Use the class `DecisionBoundaryDisplay` from the module\n", |
| 81 | + "`sklearn.inspection` as shown in previous course notebooks.\n", |
| 82 | + "\n", |
| 83 | + "<div class=\"admonition warning alert alert-danger\">\n", |
| 84 | + "<p class=\"first admonition-title\" style=\"font-weight: bold;\">Warning</p>\n", |
| 85 | + "<p class=\"last\">At this time, it is not possible to use <tt class=\"docutils literal\"><span class=\"pre\">response_method=\"predict_proba\"</span></tt> for\n", |
| 86 | + "multiclass problems. This is a planned feature for a future version of\n", |
| 87 | + "scikit-learn. In the mean time, you can use <tt class=\"docutils literal\"><span class=\"pre\">response_method=\"predict\"</span></tt>\n", |
| 88 | + "instead.</p>\n", |
| 89 | + "</div>" |
68 | 90 | ]
|
69 | 91 | },
|
70 | 92 | {
|
|
0 commit comments