diff --git a/DecisionTree.ipynb b/DecisionTree.ipynb new file mode 100644 index 0000000..11b37d4 --- /dev/null +++ b/DecisionTree.ipynb @@ -0,0 +1,671 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 7, + "id": "156d7fbe-f7f8-4d58-af3c-26cd55a345c4", + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "from sklearn.tree import DecisionTreeClassifier, plot_tree" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "aea0c6f2-e2c6-4fb7-8c84-6c5cc529e231", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + " | age | \n", + "sex | \n", + "cp | \n", + "trestbps | \n", + "chol | \n", + "fbs | \n", + "restecg | \n", + "thalach | \n", + "exang | \n", + "oldpeak | \n", + "slope | \n", + "ca | \n", + "thal | \n", + "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", + "63 | \n", + "1 | \n", + "1 | \n", + "145 | \n", + "233 | \n", + "1 | \n", + "2 | \n", + "150 | \n", + "0 | \n", + "2.3 | \n", + "3 | \n", + "0.0 | \n", + "6.0 | \n", + "
1 | \n", + "67 | \n", + "1 | \n", + "4 | \n", + "160 | \n", + "286 | \n", + "0 | \n", + "2 | \n", + "108 | \n", + "1 | \n", + "1.5 | \n", + "2 | \n", + "3.0 | \n", + "3.0 | \n", + "
2 | \n", + "67 | \n", + "1 | \n", + "4 | \n", + "120 | \n", + "229 | \n", + "0 | \n", + "2 | \n", + "129 | \n", + "1 | \n", + "2.6 | \n", + "2 | \n", + "2.0 | \n", + "7.0 | \n", + "
3 | \n", + "37 | \n", + "1 | \n", + "3 | \n", + "130 | \n", + "250 | \n", + "0 | \n", + "0 | \n", + "187 | \n", + "0 | \n", + "3.5 | \n", + "3 | \n", + "0.0 | \n", + "3.0 | \n", + "
4 | \n", + "41 | \n", + "0 | \n", + "2 | \n", + "130 | \n", + "204 | \n", + "0 | \n", + "2 | \n", + "172 | \n", + "0 | \n", + "1.4 | \n", + "1 | \n", + "0.0 | \n", + "3.0 | \n", + "
DecisionTreeClassifier(max_depth=3)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
DecisionTreeClassifier(max_depth=3)