Skip to content

Commit

Permalink
chore: rebase on master
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbatinif committed Aug 3, 2022
2 parents 3566780 + 8984103 commit ee73090
Showing 1 changed file with 62 additions and 22 deletions.
84 changes: 62 additions & 22 deletions demo/DemoClassification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 16,
"id": "6b710e7c",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -46,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 17,
"id": "f8e46c49",
"metadata": {},
"outputs": [],
Expand All @@ -65,7 +65,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 18,
"id": "38d5afb0",
"metadata": {},
"outputs": [],
Expand All @@ -84,7 +84,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 19,
"id": "4f807185",
"metadata": {},
"outputs": [
Expand All @@ -93,7 +93,7 @@
"text/plain": " target\n0 setosa\n1 setosa\n2 setosa\n3 setosa\n4 setosa\n.. ...\n145 virginica\n146 virginica\n147 virginica\n148 virginica\n149 virginica\n\n[150 rows x 1 columns]",
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>target</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>setosa</td>\n </tr>\n <tr>\n <th>1</th>\n <td>setosa</td>\n </tr>\n <tr>\n <th>2</th>\n <td>setosa</td>\n </tr>\n <tr>\n <th>3</th>\n <td>setosa</td>\n </tr>\n <tr>\n <th>4</th>\n <td>setosa</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n </tr>\n <tr>\n <th>145</th>\n <td>virginica</td>\n </tr>\n <tr>\n <th>146</th>\n <td>virginica</td>\n </tr>\n <tr>\n <th>147</th>\n <td>virginica</td>\n </tr>\n <tr>\n <th>148</th>\n <td>virginica</td>\n </tr>\n <tr>\n <th>149</th>\n <td>virginica</td>\n </tr>\n </tbody>\n</table>\n<p>150 rows × 1 columns</p>\n</div>"
},
"execution_count": 4,
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -114,7 +114,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 20,
"id": "7ac49b4e",
"metadata": {},
"outputs": [
Expand All @@ -123,7 +123,7 @@
"text/plain": " SepalLength SepalWidth PetalLength PetalWidth iris\n0 5.1 3.5 1.4 0.2 setosa\n1 4.9 3.0 1.4 0.2 setosa\n2 4.7 3.2 1.3 0.2 setosa\n3 4.6 3.1 1.5 0.2 setosa\n4 5.0 3.6 1.4 0.2 setosa\n.. ... ... ... ... ...\n145 6.7 3.0 5.2 2.3 virginica\n146 6.3 2.5 5.0 1.9 virginica\n147 6.5 3.0 5.2 2.0 virginica\n148 6.2 3.4 5.4 2.3 virginica\n149 5.9 3.0 5.1 1.8 virginica\n\n[150 rows x 5 columns]",
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>SepalLength</th>\n <th>SepalWidth</th>\n <th>PetalLength</th>\n <th>PetalWidth</th>\n <th>iris</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>5.1</td>\n <td>3.5</td>\n <td>1.4</td>\n <td>0.2</td>\n <td>setosa</td>\n </tr>\n <tr>\n <th>1</th>\n <td>4.9</td>\n <td>3.0</td>\n <td>1.4</td>\n <td>0.2</td>\n <td>setosa</td>\n </tr>\n <tr>\n <th>2</th>\n <td>4.7</td>\n <td>3.2</td>\n <td>1.3</td>\n <td>0.2</td>\n <td>setosa</td>\n </tr>\n <tr>\n <th>3</th>\n <td>4.6</td>\n <td>3.1</td>\n <td>1.5</td>\n <td>0.2</td>\n <td>setosa</td>\n </tr>\n <tr>\n <th>4</th>\n <td>5.0</td>\n <td>3.6</td>\n <td>1.4</td>\n <td>0.2</td>\n <td>setosa</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>145</th>\n <td>6.7</td>\n <td>3.0</td>\n <td>5.2</td>\n <td>2.3</td>\n <td>virginica</td>\n </tr>\n <tr>\n <th>146</th>\n <td>6.3</td>\n <td>2.5</td>\n <td>5.0</td>\n <td>1.9</td>\n <td>virginica</td>\n </tr>\n <tr>\n <th>147</th>\n <td>6.5</td>\n <td>3.0</td>\n <td>5.2</td>\n <td>2.0</td>\n <td>virginica</td>\n </tr>\n <tr>\n <th>148</th>\n <td>6.2</td>\n <td>3.4</td>\n <td>5.4</td>\n <td>2.3</td>\n <td>virginica</td>\n </tr>\n <tr>\n <th>149</th>\n <td>5.9</td>\n <td>3.0</td>\n <td>5.1</td>\n <td>1.8</td>\n <td>virginica</td>\n </tr>\n </tbody>\n</table>\n<p>150 rows × 5 columns</p>\n</div>"
},
"execution_count": 5,
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -145,7 +145,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 21,
"id": "03fc5e2c",
"metadata": {},
"outputs": [],
Expand All @@ -164,15 +164,15 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 22,
"id": "aa8a3128",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": "0.96"
},
"execution_count": 7,
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -185,7 +185,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 23,
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -231,24 +231,64 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 24,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CART performance (3 rules):\n",
"Accuracy = 0.95\n",
"Fidelity = 0.96\n",
"Accuracy = 0.40\n",
"Fidelity = 0.39\n",
"\n",
"\n",
"CART extracted rules:\n",
"\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, virginica) :-\n",
" PetalWidth =< 0.45, SepalLength =< 4.65, SepalWidth =< 2.65.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, setosa) :-\n",
" PetalWidth =< 0.45, SepalLength =< 4.65, SepalWidth =< 3.15.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, versicolor) :-\n",
" PetalWidth =< 0.45, SepalLength =< 4.65, PetalWidth =< 0.25, SepalLength =< 4.5.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, setosa) :-\n",
" PetalWidth =< 0.45, SepalLength =< 4.65, PetalWidth =< 0.25.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, versicolor) :-\n",
" PetalWidth =< 0.45, SepalLength =< 4.65.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, setosa) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05, SepalWidth =< 3.75, PetalWidth =< 0.35, PetalLength =< 1.35.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, setosa) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05, SepalWidth =< 3.75, PetalWidth =< 0.35, SepalWidth =< 3.55, SepalWidth =< 3.05, SepalLength =< 4.85.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, virginica) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05, SepalWidth =< 3.75, PetalWidth =< 0.35, SepalWidth =< 3.55, SepalWidth =< 3.05, SepalLength =< 4.95.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, setosa) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05, SepalWidth =< 3.75, PetalWidth =< 0.35, SepalWidth =< 3.55, SepalWidth =< 3.05.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, virginica) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05, SepalWidth =< 3.75, PetalWidth =< 0.35, SepalWidth =< 3.55, SepalWidth =< 3.15, PetalWidth =< 0.15.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, versicolor) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05, SepalWidth =< 3.75, PetalWidth =< 0.35, SepalWidth =< 3.55, SepalWidth =< 3.15.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, virginica) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05, SepalWidth =< 3.75, PetalWidth =< 0.35, SepalWidth =< 3.55, SepalWidth =< 3.45.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, setosa) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05, SepalWidth =< 3.75, PetalWidth =< 0.35, SepalWidth =< 3.55, PetalWidth =< 0.25.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, virginica) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05, SepalWidth =< 3.75, PetalWidth =< 0.35, SepalWidth =< 3.55.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, versicolor) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05, SepalWidth =< 3.75, PetalWidth =< 0.35.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, setosa) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05, SepalWidth =< 3.75.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, virginica) :-\n",
" PetalWidth =< 0.45, SepalWidth =< 4.05.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, setosa) :-\n",
" PetalWidth =< 0.45.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, versicolor) :-\n",
" PetalLength =< 4.2.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, virginica) :-\n",
" SepalLength =< 6.5, SepalLength =< 5.8.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, setosa) :-\n",
" PetalLength =< 2.35.\n",
" SepalLength =< 6.5, PetalLength =< 4.85.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, versicolor) :-\n",
" PetalWidth =< 1.75.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, virginica).\n"
" SepalLength =< 6.5.\n",
"iris(PetalLength, PetalWidth, SepalLength, SepalWidth, versicolor).\n"
]
}
],
Expand Down Expand Up @@ -279,7 +319,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 25,
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -317,7 +357,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 26,
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -392,7 +432,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 27,
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -429,7 +469,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 28,
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -466,7 +506,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 28,
"outputs": [],
"source": [],
"metadata": {
Expand Down

0 comments on commit ee73090

Please sign in to comment.