diff --git a/demo/DemoClassification.ipynb b/demo/DemoClassification.ipynb index 4882e498..26bac02c 100644 --- a/demo/DemoClassification.ipynb +++ b/demo/DemoClassification.ipynb @@ -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\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" ] } ], @@ -469,7 +466,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "outputs": [], "source": [], "metadata": {