Skip to content

Commit

Permalink
fix: iter for classification
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbatinif committed Aug 3, 2022
1 parent 8865186 commit 3566780
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions demo/DemoClassification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -231,27 +231,24 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 9,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CART performance (3 rules):\n",
"Accuracy = 0.40\n",
"Fidelity = 0.39\n",
"\n"
]
},
{
"ename": "TypeError",
"evalue": "can only concatenate str (not \"it.unibo.tuprolog.theory.impl.MutableIndexedTheory\") to str",
"output_type": "error",
"traceback": [
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[1;31mTypeError\u001B[0m Traceback (most recent call last)",
"\u001B[1;32m~\\AppData\\Local\\Temp/ipykernel_12108/2184489703.py\u001B[0m in \u001B[0;36m<module>\u001B[1;34m\u001B[0m\n\u001B[0;32m 6\u001B[0m \u001B[0mprint\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;34mf'Fidelity = {cart.accuracy(test, predictor):.2f}\\n'\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0;32m 7\u001B[0m \u001B[1;31m#print('\\nCART extracted rules:\\n\\n' + pretty_theory(theory_from_cart))\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[1;32m----> 8\u001B[1;33m \u001B[0mprint\u001B[0m\u001B[1;33m(\u001B[0m\u001B[1;34m'\\nCART extracted rules:\\n\\n'\u001B[0m \u001B[1;33m+\u001B[0m \u001B[0mtheory_from_cart\u001B[0m\u001B[1;33m)\u001B[0m\u001B[1;33m\u001B[0m\u001B[1;33m\u001B[0m\u001B[0m\n\u001B[0m",
"\u001B[1;31mTypeError\u001B[0m: can only concatenate str (not \"it.unibo.tuprolog.theory.impl.MutableIndexedTheory\") to str"
"Accuracy = 0.95\n",
"Fidelity = 0.96\n",
"\n",
"\n",
"CART extracted rules:\n",
"\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, setosa) :-\n",
" PetalLength =< 2.35.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, versicolor) :-\n",
" PetalWidth =< 1.75.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, virginica).\n"
]
}
],
Expand Down Expand Up @@ -469,7 +466,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"outputs": [],
"source": [],
"metadata": {
Expand Down

0 comments on commit 3566780

Please sign in to comment.