Skip to content

Commit bb60bab

Browse files
committed
Decision trees
1 parent fa014b6 commit bb60bab

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import IPython, graphviz, re\n",
10+
"from io import StringIO\n",
11+
"from IPython.display import Image\n",
12+
"import numpy as np\n",
13+
"import pandas as pd\n",
14+
"import math\n",
15+
"from sklearn import tree\n",
16+
"from sklearn.datasets import load_boston, load_iris\n",
17+
"from collections import defaultdict"
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": 2,
23+
"metadata": {},
24+
"outputs": [],
25+
"source": [
26+
"from dtreeviz.trees import *\n",
27+
"\n",
28+
"regr = tree.DecisionTreeRegressor(max_depth=5, random_state=666)\n",
29+
"boston = load_boston()\n"
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": null,
35+
"metadata": {},
36+
"outputs": [],
37+
"source": []
38+
}
39+
],
40+
"metadata": {
41+
"kernelspec": {
42+
"display_name": "Python 3",
43+
"language": "python",
44+
"name": "python3"
45+
},
46+
"language_info": {
47+
"codemirror_mode": {
48+
"name": "ipython",
49+
"version": 3
50+
},
51+
"file_extension": ".py",
52+
"mimetype": "text/x-python",
53+
"name": "python",
54+
"nbconvert_exporter": "python",
55+
"pygments_lexer": "ipython3",
56+
"version": "3.6.8"
57+
}
58+
},
59+
"nbformat": 4,
60+
"nbformat_minor": 2
61+
}

21.Decision TreesVIz.ipynb

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import IPython, graphviz, re\n",
10+
"from io import StringIO\n",
11+
"from IPython.display import Image\n",
12+
"import numpy as np\n",
13+
"import pandas as pd\n",
14+
"import math\n",
15+
"from sklearn import tree\n",
16+
"from sklearn.datasets import load_boston, load_iris\n",
17+
"from collections import defaultdict"
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": 2,
23+
"metadata": {},
24+
"outputs": [],
25+
"source": [
26+
"from dtreeviz.trees import *\n",
27+
"\n",
28+
"regr = tree.DecisionTreeRegressor(max_depth=5, random_state=666)\n",
29+
"boston = load_boston()\n"
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": 3,
35+
"metadata": {},
36+
"outputs": [],
37+
"source": [
38+
"X_train = pd.DataFrame(boston.data, columns=boston.feature_names)\n",
39+
"y_train = boston.target\n"
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": null,
45+
"metadata": {},
46+
"outputs": [],
47+
"source": []
48+
}
49+
],
50+
"metadata": {
51+
"kernelspec": {
52+
"display_name": "Python 3",
53+
"language": "python",
54+
"name": "python3"
55+
},
56+
"language_info": {
57+
"codemirror_mode": {
58+
"name": "ipython",
59+
"version": 3
60+
},
61+
"file_extension": ".py",
62+
"mimetype": "text/x-python",
63+
"name": "python",
64+
"nbconvert_exporter": "python",
65+
"pygments_lexer": "ipython3",
66+
"version": "3.6.8"
67+
}
68+
},
69+
"nbformat": 4,
70+
"nbformat_minor": 2
71+
}

0 commit comments

Comments
 (0)