{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Labo 7 Data Science: Decision Trees" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
plt.gca().set_aspect('equal', adjustable='box')
"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**2.2 Decision trees: visualisatie van de decision boundary**\n",
"\n",
"* Deel de data in in een training- en testset (70%/30%)\n",
"* Train een DecisionTreeClassifier met de trainingsdata en meet de accuracy op de training- en testdata\n",
"* We gaan nu de decision boundary benaderen door eerst de voorspelling op te vragen voor een grid van (x,y)-coördinaten die de volledige grafiek bedekt. Deze grid genereer je als volgt:\n",
"\n",
"grid = np.mgrid[-4:8.6:0.05, -4:6:0.05].reshape(2,-1).T
\n",
"\n",
"* De voorspelde waarden kan je ook weer rechtstreeks doorgeven als kleur van de scatter-plot\n",
"\n",
"\n",
"* Pas nu je script aan zodat je voor max_depth van 1 t.e.m. 8 de accuracies print en de decision boundary plot\n",
"\n",
"Kan je de decision boundary van max_depth=1 verklaren? Kan je de instelling met de beste bias-variance tradeoff ook visueel verklaren a.d.h.v. de decsion boundary?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**2.3 Random forests en gradient boosting machines**\n",
"\n",
"* Toon nu ook de accuracies en de decision boundary voor Random forests en gradient boosting machines\n",
"* Random forests: waarom heeft parameter tuning van max_features hier geen zin?\n",
"* Gradient boosting machines: experimenteer eens met de learning_rate ."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}