diff --git a/DecisionTree.ipynb b/DecisionTree.ipynb index ac40b40..16d5a4d 100644 --- a/DecisionTree.ipynb +++ b/DecisionTree.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 26, + "execution_count": 31, "id": "d5618056", "metadata": {}, "outputs": [], @@ -21,7 +21,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 32, "id": "d336971a", "metadata": {}, "outputs": [], @@ -92,6 +92,8 @@ " i = node\n", " if i[1] == \"l\":\n", " clause.append({\"feature\": i[3], \"operation\": \"<=\", \"value\": i[2]})\n", + " else:\n", + " clause.append({\"feature\": i[3], \"operation\": \">\", \"value\": i[2]})\n", " \n", " a = list(value[node][0])\n", " ind = a.index(max(a))\n", @@ -103,10 +105,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "id": "b96f3403", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "train accuracy: 0.879490682862549\n", + "test accuracy: 0.879490682862549\n" + ] + } + ], "source": [ "# Training set X and Y\n", "Set1 = pd.read_csv(inputfile)\n", @@ -138,7 +149,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 34, "id": "7f36344d", "metadata": {}, "outputs": [], @@ -154,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 35, "id": "cf8832b9", "metadata": {}, "outputs": [