mirror of
https://github.com/ltcptgeneral/IdealRMT-DecisionTrees.git
synced 2025-09-06 07:17:23 +00:00
fix issue in tree saving
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 26,
|
"execution_count": 31,
|
||||||
"id": "d5618056",
|
"id": "d5618056",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 27,
|
"execution_count": 32,
|
||||||
"id": "d336971a",
|
"id": "d336971a",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
@@ -92,6 +92,8 @@
|
|||||||
" i = node\n",
|
" i = node\n",
|
||||||
" if i[1] == \"l\":\n",
|
" if i[1] == \"l\":\n",
|
||||||
" clause.append({\"feature\": i[3], \"operation\": \"<=\", \"value\": i[2]})\n",
|
" clause.append({\"feature\": i[3], \"operation\": \"<=\", \"value\": i[2]})\n",
|
||||||
|
" else:\n",
|
||||||
|
" clause.append({\"feature\": i[3], \"operation\": \">\", \"value\": i[2]})\n",
|
||||||
" \n",
|
" \n",
|
||||||
" a = list(value[node][0])\n",
|
" a = list(value[node][0])\n",
|
||||||
" ind = a.index(max(a))\n",
|
" ind = a.index(max(a))\n",
|
||||||
@@ -103,10 +105,19 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 33,
|
||||||
"id": "b96f3403",
|
"id": "b96f3403",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"train accuracy: 0.879490682862549\n",
|
||||||
|
"test accuracy: 0.879490682862549\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"# Training set X and Y\n",
|
"# Training set X and Y\n",
|
||||||
"Set1 = pd.read_csv(inputfile)\n",
|
"Set1 = pd.read_csv(inputfile)\n",
|
||||||
@@ -138,7 +149,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 34,
|
||||||
"id": "7f36344d",
|
"id": "7f36344d",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
@@ -154,7 +165,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 35,
|
||||||
"id": "cf8832b9",
|
"id": "cf8832b9",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
|
Reference in New Issue
Block a user