|
124 | 124 | "\n",
|
125 | 125 | "* **examples**: Holds the items of the dataset. Each item is a list of values.\n",
|
126 | 126 | "\n",
|
127 |
| - "* **attrs**: The indexes of the features (by default in the range of [0,f), where *f* is the number of features. For example, `item[i]` returns the feature at index *i* of *item*.\n", |
| 127 | + "* **attrs**: The indexes of the features (by default in the range of [0,f), where *f* is the number of features). For example, `item[i]` returns the feature at index *i* of *item*.\n", |
128 | 128 | "\n",
|
129 | 129 | "* **attrnames**: An optional list with attribute names. For example, `item[s]`, where *s* is a feature name, returns the feature of name *s* in *item*.\n",
|
130 | 130 | "\n",
|
|
1072 | 1072 | "</ol>"
|
1073 | 1073 | ]
|
1074 | 1074 | },
|
| 1075 | + { |
| 1076 | + "cell_type": "markdown", |
| 1077 | + "metadata": {}, |
| 1078 | + "source": [ |
| 1079 | + "### Example\n", |
| 1080 | + "\n", |
| 1081 | + "We will now use the Decision Tree Learner to classify a sample with values: 5.1, 3.0, 1.1, 0.1." |
| 1082 | + ] |
| 1083 | + }, |
| 1084 | + { |
| 1085 | + "cell_type": "code", |
| 1086 | + "execution_count": 2, |
| 1087 | + "metadata": {}, |
| 1088 | + "outputs": [ |
| 1089 | + { |
| 1090 | + "name": "stdout", |
| 1091 | + "output_type": "stream", |
| 1092 | + "text": [ |
| 1093 | + "setosa\n" |
| 1094 | + ] |
| 1095 | + } |
| 1096 | + ], |
| 1097 | + "source": [ |
| 1098 | + "iris = DataSet(name=\"iris\")\n", |
| 1099 | + "\n", |
| 1100 | + "DTL = DecisionTreeLearner(iris)\n", |
| 1101 | + "print(DTL([5.1, 3.0, 1.1, 0.1]))" |
| 1102 | + ] |
| 1103 | + }, |
| 1104 | + { |
| 1105 | + "cell_type": "markdown", |
| 1106 | + "metadata": {}, |
| 1107 | + "source": [ |
| 1108 | + "As expected, the Decision Tree learner classifies the sample as \"setosa\" as seen in the previous section." |
| 1109 | + ] |
| 1110 | + }, |
1075 | 1111 | {
|
1076 | 1112 | "cell_type": "markdown",
|
1077 | 1113 | "metadata": {},
|
|
1760 | 1796 | "name": "python",
|
1761 | 1797 | "nbconvert_exporter": "python",
|
1762 | 1798 | "pygments_lexer": "ipython3",
|
1763 |
| - "version": "3.5.3" |
| 1799 | + "version": "3.6.3" |
1764 | 1800 | }
|
1765 | 1801 | },
|
1766 | 1802 | "nbformat": 4,
|
|
0 commit comments