2898 lines
423 KiB
Plaintext
2898 lines
423 KiB
Plaintext
|
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 2,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"|--- ap_hi <= 129.50\n",
|
|||
|
"| |--- age <= 54.65\n",
|
|||
|
"| | |--- cholesterol <= 2.50\n",
|
|||
|
"| | | |--- age <= 43.79\n",
|
|||
|
"| | | | |--- cholesterol <= 1.50\n",
|
|||
|
"| | | | | |--- ap_hi <= 114.50\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- ap_hi > 114.50\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | |--- cholesterol > 1.50\n",
|
|||
|
"| | | | | |--- bmi <= 28.87\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- bmi > 28.87\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | |--- age > 43.79\n",
|
|||
|
"| | | | |--- ap_hi <= 119.50\n",
|
|||
|
"| | | | | |--- bmi <= 22.05\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- bmi > 22.05\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | |--- ap_hi > 119.50\n",
|
|||
|
"| | | | | |--- bmi <= 27.71\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- bmi > 27.71\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | |--- cholesterol > 2.50\n",
|
|||
|
"| | | |--- bmi <= 29.04\n",
|
|||
|
"| | | | |--- age <= 41.60\n",
|
|||
|
"| | | | | |--- ap_hi <= 115.00\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- ap_hi > 115.00\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | |--- age > 41.60\n",
|
|||
|
"| | | | | |--- age <= 54.17\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- age > 54.17\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | |--- bmi > 29.04\n",
|
|||
|
"| | | | |--- age <= 54.01\n",
|
|||
|
"| | | | | |--- age <= 39.75\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- age > 39.75\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | |--- age > 54.01\n",
|
|||
|
"| | | | | |--- bmi <= 35.02\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- bmi > 35.02\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| |--- age > 54.65\n",
|
|||
|
"| | |--- cholesterol <= 2.50\n",
|
|||
|
"| | | |--- age <= 60.71\n",
|
|||
|
"| | | | |--- ap_hi <= 118.50\n",
|
|||
|
"| | | | | |--- bmi <= 23.33\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- bmi > 23.33\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | |--- ap_hi > 118.50\n",
|
|||
|
"| | | | | |--- bmi <= 32.89\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- bmi > 32.89\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | |--- age > 60.71\n",
|
|||
|
"| | | | |--- bmi <= 20.51\n",
|
|||
|
"| | | | | |--- age <= 64.31\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- age > 64.31\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | |--- bmi > 20.51\n",
|
|||
|
"| | | | | |--- ap_hi <= 115.50\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- ap_hi > 115.50\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | |--- cholesterol > 2.50\n",
|
|||
|
"| | | |--- bmi <= 26.03\n",
|
|||
|
"| | | | |--- age <= 60.89\n",
|
|||
|
"| | | | | |--- age <= 60.48\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- age > 60.48\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | |--- age > 60.89\n",
|
|||
|
"| | | | | |--- bmi <= 25.91\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- bmi > 25.91\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | |--- bmi > 26.03\n",
|
|||
|
"| | | | |--- age <= 59.39\n",
|
|||
|
"| | | | | |--- bmi <= 35.93\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- bmi > 35.93\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | |--- age > 59.39\n",
|
|||
|
"| | | | | |--- bmi <= 35.12\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- bmi > 35.12\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"|--- ap_hi > 129.50\n",
|
|||
|
"| |--- ap_hi <= 138.50\n",
|
|||
|
"| | |--- cholesterol <= 2.50\n",
|
|||
|
"| | | |--- age <= 59.54\n",
|
|||
|
"| | | | |--- bmi <= 21.64\n",
|
|||
|
"| | | | | |--- bmi <= 17.30\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- bmi > 17.30\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | |--- bmi > 21.64\n",
|
|||
|
"| | | | | |--- age <= 39.99\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- age > 39.99\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | |--- age > 59.54\n",
|
|||
|
"| | | | |--- age <= 62.46\n",
|
|||
|
"| | | | | |--- bmi <= 20.61\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- bmi > 20.61\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | |--- age > 62.46\n",
|
|||
|
"| | | | | |--- age <= 64.00\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- age > 64.00\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | |--- cholesterol > 2.50\n",
|
|||
|
"| | | |--- bmi <= 30.74\n",
|
|||
|
"| | | | |--- bmi <= 30.06\n",
|
|||
|
"| | | | | |--- bmi <= 23.93\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- bmi > 23.93\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | |--- bmi > 30.06\n",
|
|||
|
"| | | | | |--- bmi <= 30.69\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- bmi > 30.69\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | |--- bmi > 30.74\n",
|
|||
|
"| | | | |--- bmi <= 32.05\n",
|
|||
|
"| | | | | |--- age <= 43.63\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- age > 43.63\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | |--- bmi > 32.05\n",
|
|||
|
"| | | | | |--- bmi <= 32.34\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- bmi > 32.34\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| |--- ap_hi > 138.50\n",
|
|||
|
"| | |--- ap_hi <= 149.50\n",
|
|||
|
"| | | |--- age <= 39.56\n",
|
|||
|
"| | | | |--- bmi <= 38.19\n",
|
|||
|
"| | | | | |--- age <= 39.54\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- age > 39.54\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | |--- bmi > 38.19\n",
|
|||
|
"| | | | | |--- bmi <= 50.55\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- bmi > 50.55\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | |--- age > 39.56\n",
|
|||
|
"| | | | |--- age <= 47.57\n",
|
|||
|
"| | | | | |--- bmi <= 19.23\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"| | | | | |--- bmi > 19.23\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | |--- age > 47.57\n",
|
|||
|
"| | | | | |--- age <= 61.57\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- age > 61.57\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | |--- ap_hi > 149.50\n",
|
|||
|
"| | | |--- bmi <= 20.48\n",
|
|||
|
"| | | | |--- age <= 64.27\n",
|
|||
|
"| | | | | |--- age <= 55.82\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- age > 55.82\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | |--- age > 64.27\n",
|
|||
|
"| | | | | |--- class: 0\n",
|
|||
|
"| | | |--- bmi > 20.48\n",
|
|||
|
"| | | | |--- age <= 64.35\n",
|
|||
|
"| | | | | |--- age <= 49.82\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- age > 49.82\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | |--- age > 64.35\n",
|
|||
|
"| | | | | |--- bmi <= 36.80\n",
|
|||
|
"| | | | | | |--- class: 1\n",
|
|||
|
"| | | | | |--- bmi > 36.80\n",
|
|||
|
"| | | | | | |--- class: 0\n",
|
|||
|
"\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"import pickle\n",
|
|||
|
"import pandas as pd\n",
|
|||
|
"from sklearn import tree\n",
|
|||
|
"\n",
|
|||
|
"df = pd.read_csv(\"data-cardio/cardio_clear.csv\", index_col=\"id\")\n",
|
|||
|
"model = pickle.load(open(\"data-cardio//cardio.model.sav\", \"rb\"))\n",
|
|||
|
"features = (\n",
|
|||
|
" df\n",
|
|||
|
" .drop([\"cardio\"], axis=1)\n",
|
|||
|
" .columns.values.tolist()\n",
|
|||
|
")\n",
|
|||
|
"\n",
|
|||
|
"rules = tree.export_text(model, feature_names=features)\n",
|
|||
|
"print(rules)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 3,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"63"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"[if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (age <= 43.792) and (cholesterol <= 1.5) and (ap_hi <= 114.5) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (age <= 43.792) and (cholesterol <= 1.5) and (ap_hi > 114.5) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (age <= 43.792) and (cholesterol > 1.5) and (bmi <= 28.874) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (age <= 43.792) and (cholesterol > 1.5) and (bmi > 28.874) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (age > 43.792) and (ap_hi <= 119.5) and (bmi <= 22.045) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (age > 43.792) and (ap_hi <= 119.5) and (bmi > 22.045) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (age > 43.792) and (ap_hi > 119.5) and (bmi <= 27.71) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (age > 43.792) and (ap_hi > 119.5) and (bmi > 27.71) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) and (age <= 41.599) and (ap_hi <= 115.0) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) and (age <= 41.599) and (ap_hi > 115.0) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) and (age > 41.599) and (age <= 54.167) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) and (age > 41.599) and (age > 54.167) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi > 29.043) and (age <= 54.008) and (age <= 39.751) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi > 29.043) and (age <= 54.008) and (age > 39.751) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi > 29.043) and (age > 54.008) and (bmi <= 35.021) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi > 29.043) and (age > 54.008) and (bmi > 35.021) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (age <= 60.707) and (ap_hi <= 118.5) and (bmi <= 23.329) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (age <= 60.707) and (ap_hi <= 118.5) and (bmi > 23.329) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (age <= 60.707) and (ap_hi > 118.5) and (bmi <= 32.886) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (age <= 60.707) and (ap_hi > 118.5) and (bmi > 32.886) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (age > 60.707) and (bmi <= 20.512) and (age <= 64.308) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (age > 60.707) and (bmi <= 20.512) and (age > 64.308) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (age > 60.707) and (bmi > 20.512) and (ap_hi <= 115.5) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (age > 60.707) and (bmi > 20.512) and (ap_hi > 115.5) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) and (age <= 60.891) and (age <= 60.479) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) and (age <= 60.891) and (age > 60.479) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) and (age > 60.891) and (bmi <= 25.912) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) and (age > 60.891) and (bmi > 25.912) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) and (age <= 59.39) and (bmi <= 35.932) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) and (age <= 59.39) and (bmi > 35.932) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) and (age > 59.39) and (bmi <= 35.121) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) and (age > 59.39) and (bmi > 35.121) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi <= 21.637) and (bmi <= 17.3) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi <= 21.637) and (bmi > 17.3) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi > 21.637) and (age <= 39.989) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi > 21.637) and (age > 39.989) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 62.463) and (bmi <= 20.614) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 62.463) and (bmi > 20.614) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age > 62.463) and (age <= 63.998) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age > 62.463) and (age > 63.998) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) and (bmi <= 30.056) and (bmi <= 23.927) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) and (bmi <= 30.056) and (bmi > 23.927) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) and (bmi > 30.056) and (bmi <= 30.69) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) and (bmi > 30.056) and (bmi > 30.69) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.049) and (age <= 43.632) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.049) and (age > 43.632) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi > 32.049) and (bmi <= 32.337) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi > 32.049) and (bmi > 32.337) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi <= 38.186) and (age <= 39.538) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi <= 38.186) and (age > 39.538) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi > 38.186) and (bmi <= 50.547) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi > 38.186) and (bmi > 50.547) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 47.569) and (bmi <= 19.231) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 47.569) and (bmi > 19.231) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi <= 149.5) and (age > 39.558) and (age > 47.569) and (age <= 61.572) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi <= 149.5) and (age > 39.558) and (age > 47.569) and (age > 61.572) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi > 149.5) and (bmi <= 20.482) and (age <= 64.269) and (age <= 55.817) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi > 149.5) and (bmi <= 20.482) and (age <= 64.269) and (age > 55.817) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi > 149.5) and (bmi <= 20.482) and (age > 64.269) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi > 149.5) and (bmi > 20.482) and (age <= 64.351) and (age <= 49.818) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi > 149.5) and (bmi > 20.482) and (age <= 64.351) and (age > 49.818) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi > 149.5) and (bmi > 20.482) and (age > 64.351) and (bmi <= 36.796) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi > 138.5) and (ap_hi > 149.5) and (bmi > 20.482) and (age > 64.351) and (bmi > 36.796) -> 0]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 3,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from src.rules import get_rules\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"rules = get_rules(model, features, [0, 1])\n",
|
|||
|
"display(len(rules))\n",
|
|||
|
"rules"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 4,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"63"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"[if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 114.5) and (age <= 54.65) and (cholesterol <= 2.5) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (cholesterol > 1.5) and (bmi <= 28.874) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (cholesterol > 1.5) and (bmi > 28.874) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi <= 22.045) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi > 22.045) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 119.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi <= 27.71) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 119.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi > 27.71) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 115.0) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 41.599) and (cholesterol > 2.5) and (bmi <= 29.043) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 41.599) and (cholesterol > 2.5) and (bmi <= 29.043) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi > 29.043) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 39.751) and (cholesterol > 2.5) and (bmi > 29.043) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 54.008) and (cholesterol > 2.5) and (bmi > 29.043) and (bmi <= 35.021) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 54.008) and (cholesterol > 2.5) and (bmi > 29.043) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi <= 23.329) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi > 23.329) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 118.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi <= 32.886) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 118.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi > 32.886) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 64.308) and (cholesterol <= 2.5) and (bmi <= 20.512) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi <= 20.512) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi > 20.512) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 115.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi > 20.512) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 60.891) and (cholesterol > 2.5) and (bmi <= 26.032) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 60.891) and (cholesterol > 2.5) and (bmi <= 26.032) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) and (bmi > 25.912) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 59.39) and (cholesterol > 2.5) and (bmi > 26.032) and (bmi <= 35.932) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 59.39) and (cholesterol > 2.5) and (bmi > 26.032) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) and (bmi <= 35.121) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi <= 21.637) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi <= 21.637) and (bmi > 17.3) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi > 21.637) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (age > 39.989) and (bmi > 21.637) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 62.463) and (bmi <= 20.614) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 62.463) and (bmi > 20.614) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 63.998) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) and (bmi > 23.927) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) and (bmi > 30.056) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) and (bmi > 30.056) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.049) and (age <= 43.632) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.049) and (age > 43.632) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.337) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi <= 38.186) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (age > 39.538) and (bmi <= 38.186) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi > 38.186) and (bmi <= 50.547) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi > 38.186) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 47.569) and (bmi <= 19.231) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 47.569) and (bmi > 19.231) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 61.572) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi <= 20.482) and (age <= 64.269) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi <= 20.482) and (age <= 64.269) and (age > 55.817) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi <= 20.482) and (age > 64.269) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (age <= 64.351) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (age <= 64.351) and (age > 49.818) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (bmi <= 36.796) and (age > 64.351) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (age > 64.351) -> 0]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 4,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from src.rules import normalise_rules\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"rules = normalise_rules(rules)\n",
|
|||
|
"display(len(rules))\n",
|
|||
|
"rules"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 5,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"60"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"[if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 114.5) and (age <= 54.65) and (cholesterol <= 2.5) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (cholesterol > 1.5) and (bmi <= 28.874) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (cholesterol > 1.5) and (bmi > 28.874) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi <= 22.045) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi > 22.045) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 119.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi <= 27.71) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 119.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi > 27.71) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 115.0) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 41.599) and (cholesterol > 2.5) and (bmi <= 29.043) -> 0.5,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi > 29.043) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 39.751) and (cholesterol > 2.5) and (bmi > 29.043) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 54.008) and (cholesterol > 2.5) and (bmi > 29.043) and (bmi <= 35.021) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 54.008) and (cholesterol > 2.5) and (bmi > 29.043) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi <= 23.329) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi > 23.329) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 118.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi <= 32.886) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 118.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi > 32.886) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 64.308) and (cholesterol <= 2.5) and (bmi <= 20.512) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi <= 20.512) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi > 20.512) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 115.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi > 20.512) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 60.891) and (cholesterol > 2.5) and (bmi <= 26.032) -> 0.5,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) and (bmi > 25.912) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 59.39) and (cholesterol > 2.5) and (bmi > 26.032) and (bmi <= 35.932) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 59.39) and (cholesterol > 2.5) and (bmi > 26.032) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) and (bmi <= 35.121) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi <= 21.637) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi <= 21.637) and (bmi > 17.3) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi > 21.637) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (age > 39.989) and (bmi > 21.637) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 62.463) and (bmi <= 20.614) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 62.463) and (bmi > 20.614) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 63.998) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) and (bmi > 23.927) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) and (bmi > 30.056) -> 0.5,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.049) and (age <= 43.632) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.049) and (age > 43.632) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.337) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi <= 38.186) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (age > 39.538) and (bmi <= 38.186) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi > 38.186) and (bmi <= 50.547) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi > 38.186) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 47.569) and (bmi <= 19.231) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 47.569) and (bmi > 19.231) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 61.572) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi <= 20.482) and (age <= 64.269) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi <= 20.482) and (age <= 64.269) and (age > 55.817) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi <= 20.482) and (age > 64.269) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (age <= 64.351) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (age <= 64.351) and (age > 49.818) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (bmi <= 36.796) and (age > 64.351) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (age > 64.351) -> 0]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 5,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from src.rules import delete_same_rules\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"rules = delete_same_rules(rules)\n",
|
|||
|
"display(len(rules))\n",
|
|||
|
"rules"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 102,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"57"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"[if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 114.5) and (age <= 54.65) and (cholesterol <= 2.5) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (cholesterol > 1.5) and (bmi <= 28.874) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (cholesterol > 1.5) and (bmi > 28.874) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi <= 22.045) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi > 22.045) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 119.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi <= 27.71) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 119.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi > 27.71) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 115.0) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi > 29.043) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 39.751) and (cholesterol > 2.5) and (bmi > 29.043) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 54.008) and (cholesterol > 2.5) and (bmi > 29.043) and (bmi <= 35.021) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age <= 54.65) and (age > 54.008) and (cholesterol > 2.5) and (bmi > 29.043) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi <= 23.329) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi > 23.329) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 118.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi <= 32.886) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 118.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi > 32.886) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 64.308) and (cholesterol <= 2.5) and (bmi <= 20.512) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi <= 20.512) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi > 20.512) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (ap_hi > 115.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi > 20.512) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) and (bmi > 25.912) -> 0,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 59.39) and (cholesterol > 2.5) and (bmi > 26.032) and (bmi <= 35.932) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (age <= 59.39) and (cholesterol > 2.5) and (bmi > 26.032) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) and (bmi <= 35.121) -> 1,\n",
|
|||
|
" if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi <= 21.637) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi <= 21.637) and (bmi > 17.3) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi > 21.637) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (age > 39.989) and (bmi > 21.637) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 62.463) and (bmi <= 20.614) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 62.463) and (bmi > 20.614) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 63.998) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) and (bmi > 23.927) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.049) and (age <= 43.632) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.049) and (age > 43.632) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.337) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi <= 38.186) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (age > 39.538) and (bmi <= 38.186) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi > 38.186) and (bmi <= 50.547) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi > 38.186) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 47.569) and (bmi <= 19.231) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 47.569) and (bmi > 19.231) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 61.572) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi <= 20.482) and (age <= 64.269) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi <= 20.482) and (age <= 64.269) and (age > 55.817) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi <= 20.482) and (age > 64.269) -> 0,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (age <= 64.351) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (age <= 64.351) and (age > 49.818) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (bmi <= 36.796) and (age > 64.351) -> 1,\n",
|
|||
|
" if (ap_hi > 129.5) and (bmi > 20.482) and (age > 64.351) -> 0]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 102,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"rules = [\n",
|
|||
|
" rule for rule in rules if rule.get_consequent() == 0 or rule.get_consequent() == 1\n",
|
|||
|
"]\n",
|
|||
|
"display(len(rules))\n",
|
|||
|
"rules"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 103,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"['(age <= 39.558)', '(age <= 43.632)', '(age <= 47.569)', '(age <= 54.65)', '(age <= 59.39)', '(age <= 59.536)', '(age <= 60.707)', '(age <= 61.572)', '(age <= 62.463)', '(age <= 63.998)', '(age <= 64.269)', '(age <= 64.308)', '(age <= 64.351)', '(age > 39.538)', '(age > 39.558)', '(age > 39.751)', '(age > 39.989)', '(age > 43.632)', '(age > 43.792)', '(age > 49.818)', '(age > 54.008)', '(age > 54.65)', '(age > 55.817)', '(age > 59.536)', '(age > 64.269)', '(age > 64.351)', '(ap_hi <= 129.5)', '(ap_hi <= 138.5)', '(ap_hi <= 149.5)', '(ap_hi > 114.5)', '(ap_hi > 115.0)', '(ap_hi > 115.5)', '(ap_hi > 118.5)', '(ap_hi > 119.5)', '(ap_hi > 129.5)', '(bmi <= 19.231)', '(bmi <= 20.482)', '(bmi <= 20.512)', '(bmi <= 20.614)', '(bmi <= 21.637)', '(bmi <= 22.045)', '(bmi <= 23.329)', '(bmi <= 26.032)', '(bmi <= 27.71)', '(bmi <= 28.874)', '(bmi <= 29.043)', '(bmi <= 30.744)', '(bmi <= 32.049)', '(bmi <= 32.337)', '(bmi <= 32.886)', '(bmi <= 35.021)', '(bmi <= 35.121)', '(bmi <= 35.932)', '(bmi <= 36.796)', '(bmi <= 38.186)', '(bmi <= 50.547)', '(bmi > 17.3)', '(bmi > 19.231)', '(bmi > 20.482)', '(bmi > 20.512)', '(bmi > 20.614)', '(bmi > 21.637)', '(bmi > 22.045)', '(bmi > 23.329)', '(bmi > 23.927)', '(bmi > 25.912)', '(bmi > 26.032)', '(bmi > 27.71)', '(bmi > 28.874)', '(bmi > 29.043)', '(bmi > 30.744)', '(bmi > 32.886)', '(bmi > 38.186)', '(cholesterol <= 2.5)', '(cholesterol > 1.5)', '(cholesterol > 2.5)']\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"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>(age <= 39.558)</th>\n",
|
|||
|
" <th>(age <= 43.632)</th>\n",
|
|||
|
" <th>(age <= 47.569)</th>\n",
|
|||
|
" <th>(age <= 54.65)</th>\n",
|
|||
|
" <th>(age <= 59.39)</th>\n",
|
|||
|
" <th>(age <= 59.536)</th>\n",
|
|||
|
" <th>(age <= 60.707)</th>\n",
|
|||
|
" <th>(age <= 61.572)</th>\n",
|
|||
|
" <th>(age <= 62.463)</th>\n",
|
|||
|
" <th>(age <= 63.998)</th>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <th>(bmi > 27.71)</th>\n",
|
|||
|
" <th>(bmi > 28.874)</th>\n",
|
|||
|
" <th>(bmi > 29.043)</th>\n",
|
|||
|
" <th>(bmi > 30.744)</th>\n",
|
|||
|
" <th>(bmi > 32.886)</th>\n",
|
|||
|
" <th>(bmi > 38.186)</th>\n",
|
|||
|
" <th>(cholesterol <= 2.5)</th>\n",
|
|||
|
" <th>(cholesterol > 1.5)</th>\n",
|
|||
|
" <th>(cholesterol > 2.5)</th>\n",
|
|||
|
" <th>consequent</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>rule</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) -> 0</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>if (ap_hi <= 129.5) and (ap_hi > 114.5) and (age <= 54.65) and (cholesterol <= 2.5) -> 0</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (cholesterol > 1.5) and (bmi <= 28.874) -> 0</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (cholesterol > 1.5) and (bmi > 28.874) -> 0</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>if (ap_hi <= 129.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi <= 22.045) -> 0</th>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>5 rows × 77 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" (age <= 39.558) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (age <= 43.632) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (age <= 47.569) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (age <= 54.65) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 1 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 1 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 1 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 1 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 1 \n",
|
|||
|
"\n",
|
|||
|
" (age <= 59.39) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (age <= 59.536) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (age <= 60.707) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (age <= 61.572) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (age <= 62.463) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (age <= 63.998) ... \\\n",
|
|||
|
"rule ... \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 ... \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 ... \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 ... \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 ... \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 ... \n",
|
|||
|
"\n",
|
|||
|
" (bmi > 27.71) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (bmi > 28.874) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 1 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (bmi > 29.043) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (bmi > 30.744) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (bmi > 32.886) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (bmi > 38.186) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (cholesterol <= 2.5) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 1 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 1 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 1 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 1 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 1 \n",
|
|||
|
"\n",
|
|||
|
" (cholesterol > 1.5) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 1 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 1 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" (cholesterol > 2.5) \\\n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
" consequent \n",
|
|||
|
"rule \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (ag... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cho... 0 \n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age... 0 \n",
|
|||
|
"\n",
|
|||
|
"[5 rows x 77 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 103,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from src.rules import get_features, vectorize_rules\n",
|
|||
|
"\n",
|
|||
|
"features = get_features(rules, [])\n",
|
|||
|
"print(features)\n",
|
|||
|
"\n",
|
|||
|
"df_rules = vectorize_rules(rules, features)\n",
|
|||
|
"df_rules.head(5)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 104,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"{2: 0.2028684211063448,\n",
|
|||
|
" 3: 0.16350739364416753,\n",
|
|||
|
" 4: 0.17115418740422497,\n",
|
|||
|
" 5: 0.18051062435509244,\n",
|
|||
|
" 6: 0.17312188913678084,\n",
|
|||
|
" 7: 0.20265014439953413,\n",
|
|||
|
" 8: 0.2470239144182239,\n",
|
|||
|
" 9: 0.26319032892830624}"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAGFCAYAAADw//QxAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABLs0lEQVR4nO3dd3xT1fsH8E+aTqCL0dJCoQyhrLZYoALWohYqgjJFEFkORPkKCCrDrwKitlVUFJClAgpIhS8ooBShgBbZewplV6BltgUqHcn5/XF+CcQOkjbJzfi8X6+8enNzcvMkaJ7cc+55jkoIIUBERE7LRekAiIhIWUwEREROjomAiMjJMREQETk5JgIiIifHREBE5OSYCIiInBwTARGRk2MiICJyckwEZDabN2+GSqXC8uXLlQ5Fb/DgwQgNDTXYp1KpMGnSJP39SZMmQaVS4erVq9YNjshGMBFQmVQqlVG3zZs3WzWuK1euYOTIkQgLC4OXlxcCAgLQpk0bjB07Frdu3bJqLNaQl5eHSZMmlfg5//rrrwaJjchUrkoHQLbt+++/N7j/3XffYf369cX2N2nSBMeOHbNKTNevX0erVq2Qm5uLF154AWFhYbh27RoOHjyIWbNm4dVXX0WVKlUAAPPmzYNWq7VKXJaUl5eHyZMnAwA6dOhg8Nivv/6KmTNnMhlQuTERU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8eK6tWri0qVKon4+Hhx8uTJYpePCiHEzZs3xfjx40XDhg2Fu7u7qF69umj
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 400x400 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"'The best clusters count is 9'"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from src.cluster_helper import draw_best_clusters_plot, get_best_clusters_num\n",
|
|||
|
"\n",
|
|||
|
"random_state = 9\n",
|
|||
|
"\n",
|
|||
|
"X = df_rules.copy()\n",
|
|||
|
"X = X.drop([\"consequent\"], axis=1)\n",
|
|||
|
"\n",
|
|||
|
"clusters_score = get_best_clusters_num(X, random_state)\n",
|
|||
|
"display(clusters_score)\n",
|
|||
|
"\n",
|
|||
|
"draw_best_clusters_plot(clusters_score)\n",
|
|||
|
"\n",
|
|||
|
"clusters_num = sorted(clusters_score.items(), key=lambda x: x[1], reverse=True)[0][0]\n",
|
|||
|
"display(f\"The best clusters count is {clusters_num}\")"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 106,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"Кластер 1 (16):\n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 114.5) and (age <= 54.65) and (cholesterol <= 2.5) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (cholesterol > 1.5) and (bmi <= 28.874) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol <= 2.5) and (cholesterol > 1.5) and (bmi > 28.874) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi <= 22.045) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi > 22.045) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 119.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi <= 27.71) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 119.5) and (age <= 54.65) and (age > 43.792) and (cholesterol <= 2.5) and (bmi > 27.71) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi <= 23.329) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi > 23.329) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 118.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi <= 32.886) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 118.5) and (age > 54.65) and (age <= 60.707) and (cholesterol <= 2.5) and (bmi > 32.886) -> 1;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age > 54.65) and (age <= 64.308) and (cholesterol <= 2.5) and (bmi <= 20.512) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi <= 20.512) -> 1;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi > 20.512) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 115.5) and (age > 54.65) and (cholesterol <= 2.5) and (bmi > 20.512) -> 1\n",
|
|||
|
"--------\n",
|
|||
|
"Кластер 2 (8):\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi <= 21.637) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi <= 21.637) and (bmi > 17.3) -> 0;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (bmi > 21.637) -> 0;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age <= 59.536) and (age > 39.989) and (bmi > 21.637) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 62.463) and (bmi <= 20.614) -> 0;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 62.463) and (bmi > 20.614) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) and (age <= 63.998) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol <= 2.5) and (age > 59.536) -> 1\n",
|
|||
|
"--------\n",
|
|||
|
"Кластер 3 (6):\n",
|
|||
|
"if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) -> 1;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi <= 26.032) and (bmi > 25.912) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age > 54.65) and (age <= 59.39) and (cholesterol > 2.5) and (bmi > 26.032) and (bmi <= 35.932) -> 1;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age > 54.65) and (age <= 59.39) and (cholesterol > 2.5) and (bmi > 26.032) -> 1;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) and (bmi <= 35.121) -> 1;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age > 54.65) and (cholesterol > 2.5) and (bmi > 26.032) -> 1\n",
|
|||
|
"--------\n",
|
|||
|
"Кластер 4 (3):\n",
|
|||
|
"if (ap_hi > 129.5) and (bmi <= 20.482) and (age <= 64.269) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (bmi <= 20.482) and (age <= 64.269) and (age > 55.817) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (bmi <= 20.482) and (age > 64.269) -> 0\n",
|
|||
|
"--------\n",
|
|||
|
"Кластер 5 (4):\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi <= 38.186) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (age > 39.538) and (bmi <= 38.186) -> 0;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi > 38.186) and (bmi <= 50.547) -> 0;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age <= 39.558) and (bmi > 38.186) -> 1\n",
|
|||
|
"--------\n",
|
|||
|
"Кластер 6 (6):\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi <= 30.744) and (bmi > 23.927) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.049) and (age <= 43.632) -> 0;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.049) and (age > 43.632) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) and (bmi <= 32.337) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 138.5) and (cholesterol > 2.5) and (bmi > 30.744) -> 1\n",
|
|||
|
"--------\n",
|
|||
|
"Кластер 7 (4):\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 47.569) and (bmi <= 19.231) -> 0;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 47.569) and (bmi > 19.231) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) and (age <= 61.572) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (ap_hi <= 149.5) and (age > 39.558) -> 1\n",
|
|||
|
"--------\n",
|
|||
|
"Кластер 8 (6):\n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (ap_hi > 115.0) and (age <= 54.65) and (cholesterol > 2.5) and (bmi <= 29.043) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (cholesterol > 2.5) and (bmi > 29.043) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age > 39.751) and (cholesterol > 2.5) and (bmi > 29.043) -> 1;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age > 54.008) and (cholesterol > 2.5) and (bmi > 29.043) and (bmi <= 35.021) -> 0;\n",
|
|||
|
"if (ap_hi <= 129.5) and (age <= 54.65) and (age > 54.008) and (cholesterol > 2.5) and (bmi > 29.043) -> 1\n",
|
|||
|
"--------\n",
|
|||
|
"Кластер 9 (4):\n",
|
|||
|
"if (ap_hi > 129.5) and (bmi > 20.482) and (age <= 64.351) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (bmi > 20.482) and (age <= 64.351) and (age > 49.818) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (bmi > 20.482) and (bmi <= 36.796) and (age > 64.351) -> 1;\n",
|
|||
|
"if (ap_hi > 129.5) and (bmi > 20.482) and (age > 64.351) -> 0\n",
|
|||
|
"--------\n"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from sklearn import cluster\n",
|
|||
|
"\n",
|
|||
|
"from src.cluster_helper import print_cluster_result\n",
|
|||
|
"\n",
|
|||
|
"kmeans = cluster.KMeans(n_clusters=clusters_num, random_state=random_state)\n",
|
|||
|
"kmeans.fit(X)\n",
|
|||
|
"\n",
|
|||
|
"print_cluster_result(X, clusters_num, kmeans.labels_)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 107,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"[[if (ap_hi = 7) and (age = 29.564) and (cholesterol = 1) -> 0,\n",
|
|||
|
" if (ap_hi = 122.0) and (age = 29.564) and (cholesterol = 1) -> 0,\n",
|
|||
|
" if (ap_hi = 7) and (age = 29.564) and (cholesterol = 2.0) and (bmi = 3.472) -> 0,\n",
|
|||
|
" if (ap_hi = 7) and (age = 29.564) and (cholesterol = 2.0) and (bmi = 298.667) -> 0,\n",
|
|||
|
" if (ap_hi = 7) and (age = 49.221) and (cholesterol = 1) and (bmi = 3.472) -> 0,\n",
|
|||
|
" if (ap_hi = 7) and (age = 49.221) and (cholesterol = 1) and (bmi = 298.667) -> 0,\n",
|
|||
|
" if (ap_hi = 124.5) and (age = 49.221) and (cholesterol = 1) and (bmi = 3.472) -> 0,\n",
|
|||
|
" if (ap_hi = 124.5) and (age = 49.221) and (cholesterol = 1) and (bmi = 298.667) -> 0,\n",
|
|||
|
" if (ap_hi = 7) and (age = 57.679) and (cholesterol = 1) and (bmi = 3.472) -> 0,\n",
|
|||
|
" if (ap_hi = 7) and (age = 57.679) and (cholesterol = 1) and (bmi = 298.667) -> 0,\n",
|
|||
|
" if (ap_hi = 124.0) and (age = 57.679) and (cholesterol = 1) and (bmi = 3.472) -> 0,\n",
|
|||
|
" if (ap_hi = 124.0) and (age = 57.679) and (cholesterol = 1) and (bmi = 298.667) -> 1,\n",
|
|||
|
" if (ap_hi = 7) and (age = 59.479) and (cholesterol = 1) and (bmi = 3.472) -> 0,\n",
|
|||
|
" if (ap_hi = 7) and (age = 64.924) and (cholesterol = 1) and (bmi = 3.472) -> 1,\n",
|
|||
|
" if (ap_hi = 7) and (age = 64.924) and (cholesterol = 1) and (bmi = 298.667) -> 0,\n",
|
|||
|
" if (ap_hi = 122.5) and (age = 64.924) and (cholesterol = 1) and (bmi = 298.667) -> 1],\n",
|
|||
|
" [if (ap_hi = 134.0) and (cholesterol = 1) and (age = 29.564) and (bmi = 3.472) -> 1,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 1) and (age = 29.564) and (bmi = 19.469) -> 0,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 1) and (age = 29.564) and (bmi = 298.667) -> 0,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 1) and (age = 49.762) and (bmi = 298.667) -> 1,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 1) and (age = 61.0) and (bmi = 3.472) -> 0,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 1) and (age = 61.0) and (bmi = 298.667) -> 1,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 1) and (age = 61.767) -> 1,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 1) and (age = 64.924) -> 1],\n",
|
|||
|
" [if (ap_hi = 7) and (age = 64.924) and (cholesterol = 3) and (bmi = 3.472) -> 1,\n",
|
|||
|
" if (ap_hi = 7) and (age = 64.924) and (cholesterol = 3) and (bmi = 25.972) -> 0,\n",
|
|||
|
" if (ap_hi = 7) and (age = 57.02) and (cholesterol = 3) and (bmi = 30.982) -> 1,\n",
|
|||
|
" if (ap_hi = 7) and (age = 57.02) and (cholesterol = 3) and (bmi = 298.667) -> 1,\n",
|
|||
|
" if (ap_hi = 7) and (age = 64.924) and (cholesterol = 3) and (bmi = 30.577) -> 1,\n",
|
|||
|
" if (ap_hi = 7) and (age = 64.924) and (cholesterol = 3) and (bmi = 298.667) -> 1],\n",
|
|||
|
" [if (ap_hi = 240) and (bmi = 3.472) and (age = 29.564) -> 1,\n",
|
|||
|
" if (ap_hi = 240) and (bmi = 3.472) and (age = 60.043) -> 1,\n",
|
|||
|
" if (ap_hi = 240) and (bmi = 3.472) and (age = 64.924) -> 0],\n",
|
|||
|
" [if (ap_hi = 139.5) and (age = 29.564) and (bmi = 3.472) -> 1,\n",
|
|||
|
" if (ap_hi = 139.5) and (age = 39.548) and (bmi = 3.472) -> 0,\n",
|
|||
|
" if (ap_hi = 139.5) and (age = 29.564) and (bmi = 44.367) -> 0,\n",
|
|||
|
" if (ap_hi = 139.5) and (age = 29.564) and (bmi = 298.667) -> 1],\n",
|
|||
|
" [if (ap_hi = 134.0) and (cholesterol = 3) and (bmi = 3.472) -> 1,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 3) and (bmi = 27.336) -> 1,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 3) and (bmi = 31.396) and (age = 29.564) -> 0,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 3) and (bmi = 31.396) and (age = 64.924) -> 1,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 3) and (bmi = 31.54) -> 1,\n",
|
|||
|
" if (ap_hi = 134.0) and (cholesterol = 3) and (bmi = 298.667) -> 1],\n",
|
|||
|
" [if (ap_hi = 139.5) and (age = 43.563) and (bmi = 3.472) -> 0,\n",
|
|||
|
" if (ap_hi = 139.5) and (age = 43.563) and (bmi = 298.667) -> 1,\n",
|
|||
|
" if (ap_hi = 139.5) and (age = 50.565) -> 1,\n",
|
|||
|
" if (ap_hi = 139.5) and (age = 64.924) -> 1],\n",
|
|||
|
" [if (ap_hi = 7) and (age = 29.564) and (cholesterol = 3) and (bmi = 3.472) -> 0,\n",
|
|||
|
" if (ap_hi = 122.25) and (age = 29.564) and (cholesterol = 3) and (bmi = 3.472) -> 0,\n",
|
|||
|
" if (ap_hi = 7) and (age = 29.564) and (cholesterol = 3) and (bmi = 298.667) -> 0,\n",
|
|||
|
" if (ap_hi = 7) and (age = 47.2) and (cholesterol = 3) and (bmi = 298.667) -> 1,\n",
|
|||
|
" if (ap_hi = 7) and (age = 54.329) and (cholesterol = 3) and (bmi = 32.032) -> 0,\n",
|
|||
|
" if (ap_hi = 7) and (age = 54.329) and (cholesterol = 3) and (bmi = 298.667) -> 1],\n",
|
|||
|
" [if (ap_hi = 240) and (bmi = 298.667) and (age = 29.564) -> 1,\n",
|
|||
|
" if (ap_hi = 240) and (bmi = 298.667) and (age = 57.084) -> 1,\n",
|
|||
|
" if (ap_hi = 240) and (bmi = 28.639) and (age = 64.924) -> 1,\n",
|
|||
|
" if (ap_hi = 240) and (bmi = 298.667) and (age = 64.924) -> 0]]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 107,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from src.rules import simplify_and_group_rules\n",
|
|||
|
"\n",
|
|||
|
"clustered_rules = simplify_and_group_rules(\n",
|
|||
|
" df, rules, clusters_num, kmeans.labels_\n",
|
|||
|
")\n",
|
|||
|
"clustered_rules"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 108,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"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>count</th>\n",
|
|||
|
" <th>mean</th>\n",
|
|||
|
" <th>std</th>\n",
|
|||
|
" <th>min</th>\n",
|
|||
|
" <th>25%</th>\n",
|
|||
|
" <th>50%</th>\n",
|
|||
|
" <th>75%</th>\n",
|
|||
|
" <th>max</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>age</th>\n",
|
|||
|
" <td>68985.0</td>\n",
|
|||
|
" <td>53.290421</td>\n",
|
|||
|
" <td>6.757633</td>\n",
|
|||
|
" <td>29.564122</td>\n",
|
|||
|
" <td>48.340817</td>\n",
|
|||
|
" <td>53.939875</td>\n",
|
|||
|
" <td>58.380791</td>\n",
|
|||
|
" <td>64.924433</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>ap_hi</th>\n",
|
|||
|
" <td>68985.0</td>\n",
|
|||
|
" <td>126.325027</td>\n",
|
|||
|
" <td>17.698621</td>\n",
|
|||
|
" <td>7.000000</td>\n",
|
|||
|
" <td>120.000000</td>\n",
|
|||
|
" <td>120.000000</td>\n",
|
|||
|
" <td>140.000000</td>\n",
|
|||
|
" <td>240.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>cholesterol</th>\n",
|
|||
|
" <td>68985.0</td>\n",
|
|||
|
" <td>1.364384</td>\n",
|
|||
|
" <td>0.678691</td>\n",
|
|||
|
" <td>1.000000</td>\n",
|
|||
|
" <td>1.000000</td>\n",
|
|||
|
" <td>1.000000</td>\n",
|
|||
|
" <td>1.000000</td>\n",
|
|||
|
" <td>3.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>cardio</th>\n",
|
|||
|
" <td>68985.0</td>\n",
|
|||
|
" <td>0.494905</td>\n",
|
|||
|
" <td>0.499978</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" <td>0.000000</td>\n",
|
|||
|
" <td>1.000000</td>\n",
|
|||
|
" <td>1.000000</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>bmi</th>\n",
|
|||
|
" <td>68985.0</td>\n",
|
|||
|
" <td>27.524761</td>\n",
|
|||
|
" <td>6.081130</td>\n",
|
|||
|
" <td>3.471784</td>\n",
|
|||
|
" <td>23.875115</td>\n",
|
|||
|
" <td>26.346494</td>\n",
|
|||
|
" <td>30.119376</td>\n",
|
|||
|
" <td>298.666667</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" count mean std min 25% \\\n",
|
|||
|
"age 68985.0 53.290421 6.757633 29.564122 48.340817 \n",
|
|||
|
"ap_hi 68985.0 126.325027 17.698621 7.000000 120.000000 \n",
|
|||
|
"cholesterol 68985.0 1.364384 0.678691 1.000000 1.000000 \n",
|
|||
|
"cardio 68985.0 0.494905 0.499978 0.000000 0.000000 \n",
|
|||
|
"bmi 68985.0 27.524761 6.081130 3.471784 23.875115 \n",
|
|||
|
"\n",
|
|||
|
" 50% 75% max \n",
|
|||
|
"age 53.939875 58.380791 64.924433 \n",
|
|||
|
"ap_hi 120.000000 140.000000 240.000000 \n",
|
|||
|
"cholesterol 1.000000 1.000000 3.000000 \n",
|
|||
|
"cardio 0.000000 1.000000 1.000000 \n",
|
|||
|
"bmi 26.346494 30.119376 298.666667 "
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 108,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"df.describe().transpose()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 109,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stderr",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"/Users/user/Projects/python/fuzzy-rules-generator/.venv/lib/python3.12/site-packages/skfuzzy/control/fuzzyvariable.py:125: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n",
|
|||
|
" fig.show()\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAGyCAYAAAAYveVYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACJCElEQVR4nOzdd1gUV9vH8e/SQamiYMHeFbGjYo29axJjEhNNYpJHo8ZeQazYosYYjUZTTJ40NUbsGnvBrgF7R7EBNkBF6u77x7zhibEBLpxd9v5c117R3Sk/xhly75w55+gMBoMBIYQQQog8wkp1ACGEEEIIY5LiRgghhBB5ihQ3QgghhMhTpLgRQgghRJ4ixY0QQggh8hQpboQQQgiRp0hxI4QQQog8RYobIYQQQuQpUtwIIYQQIk+xuOLGYDCQkJCADMwshBBC5E1Ki5tdu3bRsWNHihQpgk6nIzQ09IXr7Nixg5o1a2Jvb0/ZsmVZsmRJlvZ5//59XF1duX//fvZCCyGEEMKkKS1uHj58iJ+fH/Pnz8/U8pGRkbRv355mzZoRH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qtMIYdL0Bj3Be4NxtnNmZN2RynJIcWMk3ev40LRCQUatOE5cosxNI8QzHf4WIndB53lagWMOavaEsi1h9afaFBFCiKdadnYZ+2/uZ0KDCTjbOSvLIcWNkeh0WvNUUmo641afVB1HCNN05yJsDobavaFMM9VpMk+n06aESHsEG0aoTiOESbqacJXZR2bTvUJ3GhRpoDSLFDdG5OXiwMTOVVkVfoMNx2+qjiOEadGnQ+gn2lg2LSeqTpN1LoW1Xl3Hl8OpVarTCGF
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAGyCAYAAAAYveVYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACIn0lEQVR4nOzdd1RUV9fH8e/QQamiYMHeC9gL9tg7JjHGmGh6YuwlVsSGNWqM0WhiismTpiYRu8ZeELtiw16wITZAQOrM+8d9H/IYG2XgzAz7sxZr6cyde3/jeGFzzz1n6wwGgwEhhBBCCAthpTqAEEIIIYQxSXEjhBBCCIsixY0QQgghLIoUN0IIIYSwKFLcCCGEEMKiSHEjhBBCCIsixY0QQgghLIoUN0IIIYSwKFLcCCGEEMKi5LvixmAwEBcXhyzMLIQQQlgmpcXNrl276NKlC8WKFUOn0xESEvLC1+zYsYPatWtjb29P+fLlWbp0aZaO+fDhQ1xdXXn48GH2QgshhBDCpCktbhISEvDz82PhwoWZ2v7y5ct06tSJli1bcuzYMYYMGcL777/Ppk2bcjmpEEIIIcyFzlQaZ+p0OlauXElAQMAztxk1ahTr1q3j5MmTGY+9/vrrxMTEsHHjxkwdJy4uDldXV2JjY3FxcclpbCGEEELkgT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2tBRY2Q88K0KL0arTvJiTB3SZD+f/hqM/q04jhElLTU9l3J5xlHEtQz+/fspySHFjJK2qeNGjTgmmrI3g+oNE1XGEMF27ZsGdCOi+CGzsVafJnErtoeabsHEMxESqTiOEyVp8fDEXYy4ytfFU7KztlOWQ4saIxnepiouDDSP/OI5eL5evhXjCjcO
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkYAAAGyCAYAAAABNgv+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACQp0lEQVR4nOzdd1gUV9vH8e/SQQFBFCzYKyrYUbDG3jFRE9NMYorGXmJFbNhLTKLRxBTzpNqx91gRSyzYe8EGWEFQ6u77xz4Pb4gllIWz5f5cF1d0mJ35jcuQe8+Zc45Gp9PpEEIIIYQQWKkOIIQQQghhLKQwEkIIIYT4LymMhBBCCCH+SwojIYQQQoj/ksJICCGEEOK/pDASQgghhPgvKYyEEEIIIf5LCiMhhBBCiP+SwkgIIYQQ4r8srjDS6XTEx8cjE34LIYQQ4p+UFkZ79uyhU6dOFC9eHI1GQ1hY2L++ZteuXdSuXRt7e3sqVKjAkiVLsnXOx48f4+rqyuPHj3MWWgghhBBmS2lhlJiYiJ+fHwsWLMjS/levXqVDhw40b96c48ePM3jwYD788EO2bNmSx0mFEEIIYQk0xrKIrEajYfXq1QQFBb1wn5EjR7JhwwZOnTqVse2NN97g0aNHbN68OUvniY+Px9XVlbi4OFxcXHIbWwghhBD5QKfTodFo8vw8JvWMUUREBC1btsy0rU2bNkRERLzwNcnJycTHx2f6AniclJqnWYUQCpxeDUs6QlK86iRC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OmWeUijFp1koeJstaSEC/01/dwdTd0+UpfHJmC2u9ChVawdqB+2RIhxHMtO7+Mg3cOMjFgIs52zqrj5IgURgai0WiY8Zo
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAGyCAYAAAAYveVYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACI70lEQVR4nOzddVyVd//H8dehQQkRAQO7A2xEzNmtmzHnputbZ8dMxMKOuZmby/teqXNidwe2YmEHFmABAtLn98f1u7nH1Ekc+J4Dn+fjweOh51znut5ccODDN3V6vV6PEEIIIUQeYaY6gBBCCCGEIUlxI4QQQog8RYobIYQQQuQpUtwIIYQQIk+R4kYIIYQQeYoUN0IIIYTIU6S4EUIIIUSeIsWNEEIIIfIUKW6EEEIIkafku+JGr9cTHR2NLMwshBBC5E1Ki5v9+/fTqVMnihUrhk6nIzAw8LWv2bt3L7Vr18ba2pry5cvz448/Zuqaz549w9HRkWfPnmUttBBCCCGMmtLiJjY2Fi8vL5YsWZKh42/evEmHDh1o3rw5Z86cYdiwYXz88cds27Yth5MKIYQQwlTojGXjTJ1Ox9q1a+natesrjxkzZgybNm3i/PnzaY+9/fbbREZGsnXr1gxdJzo6GkdHR6KionBwcMhubCGEEELkAr1ej06ny9CxJjXmJigoiJYtW6Z7rE2bNgQFBb3yNQkJCURHR6f7AIhJSM7RrEIIBW7sg197QXy06iRCCANbd31dho81qeImLCwMNze3dI+5ubkRHR3N8+fPX/qamTNn4ujomPbh4eEBwLxtl3I8rxAiF8U9gT8/hStbYbuf6jRCCAMKiw1j9rHZGT7epIqbr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kkVO0K1d9SnSbjdDr
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAGyCAYAAAAI3auEAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABoT0lEQVR4nO3dd3gV1drG4d9Op4YeWui9JQEEaTYQkA5SDCrdShNEevFYABUQSFAUETgqNfTeQToKCb1IDSAJPSGUtD3fH/nkHA6gSUgyuzz3deU6h8nM3k8YSd6stWa9FsMwDERERESckIvZAURERETMokJIREREnJYKIREREXFaKoRERETEaakQEhEREaelQkhERESclgohERERcVoqhERERMRpqRASERERp+V0hZBhGERHR6MNtUVERMTUQujXX3+lefPmFCxYEIvFwpIlS/7xmi1btlC1alU8PT0pVaoUM2fOTNF73r59G29vb27fvp260CIiIuIwTC2E7ty5g5+fH1OmTEnW+WfPnqVp06a8+OKLhIWF8cEHH9CjRw/Wrl2bzklFRETEEVlspemqxWJh8eLFtGrV6onnDBo0iJUrV3L48OEHx1577TVu3brFmjVrkvU+0dHReHt7ExUVRfbs2Z82toiIiNgxu1ojtGvXLho0aPDQsUaNGrFr164nXhMbG0t0dPRDHwCHLt5Kz6giIiKSVhITYNPn6fLSdlUIRURE4OPj89AxHx8foqOjuXfv3mOvGTNmDN7e3g8+fH19AXhz+l6m/XoGq9UmBsRERETkcaIuwazmsG18ury8XRVCqTFkyBCioqIefFy4cAGAjjWL8PmqY3Sf9Rs37sSZnFJEREQecWI1TK0Dt8Khy8p0eQu7KoTy589PZGTkQ8ciIyPJnj07mTJleuw1np6eZM+e/aEPgIGNy/Fjl+qEXbjFK5N+ZfeZ6+meX0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1C6Vx+xIIiJij+Lvw/oRSZsklm8OLYIgk3Mvv1AhZCcio+/zwdwwdp+9Tu8XS9Gnfmnc1MleRESS69opCOkCV09Co8/hmR522zE+LakQsiOJVoMpm08xccNJqhfNxaRAfwp4ZzI7loiI2LoD82BFP8heIKlNRoEqZieyGSqE7NDeszfoMyeU2IRExrXzo355H7MjiYiILYqNgVUfwYHZ4BcITcaBp/pb/jcVQnbq5p04Biw4wMbjV+hWpziDXymHh5umykRE5P9FHIYFXSD6T2g6HvwDzU5kk1QI2THDMPhxxznGrj5GufzZCe4YQNHcWcyOJSIiZjIM+H06rBkKecpAuxmQp7TZqWyWhhDsmMVioXvd4ix8rzbR9+NpOnk7yw78aXYsERExy71bML8TrPwQqnaCHhtUBP0DjQg5iNv34xm6+DDLD/zJa8/4Mqp5RTJ5uJodS0REMsrF3yGkK9yPghbBUKGF2YnsggohB2IYBvN+u8DHy49QJFdmgjtWpYxPNrNjiYhIerJaYVcQbPwECgbAq9MhZ1GzU9kNTY05EIvFwms1irCsV10AWgRvZ87ecHWyFxFxVDFXYXY7WD8SavWCrqtVBKWQRoQc1L24RD5ZcYQ5ey/QrEoBxrSpTDYvdbIXEXEYZ7YmdYy3JkCb76BUA7MT2SUVQg5u+YE/GbLoELmyeBDcMYAqhXOYHUlERJ5GYgJs/QJ+/QqKPwdtvods+c1OZbc0NebgmvsVZGWfuuTI7M6r3+7kh21nNFUmImKvoi7BrOawbRy8NAzeXKwi6ClpRMhJxCVY+WLNcaZvP0v9cvn4qp0fubJ4mB1LRESS68QaWPIeuGdKWhBdtJbZiRyCCiEns/FYJAMWHMDTzZVJr/lTs0RusyOJiMjfSYiDDaNg9zdQtgm0nAKZc5mdymGoEHJCl6Pu0XduGL+
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"import numpy as np\n",
|
|||
|
"from skfuzzy import control as ctrl\n",
|
|||
|
"import skfuzzy as fuzz\n",
|
|||
|
"\n",
|
|||
|
"age = ctrl.Antecedent(np.arange(29, 65, 0.5), \"age\")\n",
|
|||
|
"ap_hi = ctrl.Antecedent(np.arange(7, 240, 0.5), \"ap_hi\")\n",
|
|||
|
"cholesterol = ctrl.Antecedent([1, 2, 3], \"cholesterol\")\n",
|
|||
|
"bmi = ctrl.Antecedent(np.arange(3, 299, 0.05), \"bmi\")\n",
|
|||
|
"cardio = ctrl.Consequent([0, 1], \"cardio\")\n",
|
|||
|
"\n",
|
|||
|
"age.automf(3, variable_type=\"quant\")\n",
|
|||
|
"age.view()\n",
|
|||
|
"ap_hi.automf(3, variable_type=\"quant\")\n",
|
|||
|
"ap_hi.view()\n",
|
|||
|
"cholesterol.automf(3, variable_type=\"quant\")\n",
|
|||
|
"cholesterol.view()\n",
|
|||
|
"bmi.automf(3, variable_type=\"quant\")\n",
|
|||
|
"bmi.view()\n",
|
|||
|
"cardio.automf(2, variable_type=\"quant\", names=[\"No\", \"Yes\"])\n",
|
|||
|
"cardio.view()"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 110,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"41"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"[IF (ap_hi[low] AND age[low]) AND cholesterol[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[average] AND age[low]) AND cholesterol[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[low]) AND cholesterol[average]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[low]) AND cholesterol[average]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[average]) AND cholesterol[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[average]) AND cholesterol[low]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND age[average]) AND cholesterol[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND age[average]) AND cholesterol[low]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND age[high]) AND cholesterol[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[high]) AND cholesterol[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[high]) AND cholesterol[low]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND age[high]) AND cholesterol[low]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[low]) AND age[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[low]) AND age[low]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[low]) AND age[average]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[low]) AND age[high]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[low]) AND age[high]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[average] AND cholesterol[low]) AND age[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[high]) AND cholesterol[high]) AND bmi[low] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[high]) AND cholesterol[high]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[high] AND bmi[low]) AND age[low] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[high] AND bmi[low]) AND age[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[average] AND age[average]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[average] AND age[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[average] AND age[low]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[high]) AND bmi[low]) AND age[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[high]) AND bmi[low]) AND age[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[average] AND cholesterol[high]) AND bmi[low] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[average] AND cholesterol[high]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[average] AND age[average]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[average] AND age[average]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ap_hi[average] AND age[average] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ap_hi[average] AND age[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[low]) AND cholesterol[high]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[average] AND age[low]) AND cholesterol[high]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[low]) AND cholesterol[high]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[average]) AND cholesterol[high]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF ((ap_hi[low] AND age[average]) AND cholesterol[high]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[high] AND bmi[high]) AND age[low] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[high] AND bmi[high]) AND age[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax,\n",
|
|||
|
" IF (ap_hi[high] AND bmi[low]) AND age[high] THEN cardio[Yes]\n",
|
|||
|
" \tAND aggregation function : fmin\n",
|
|||
|
" \tOR aggregation function : fmax]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 110,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from src.rules import get_fuzzy_rules\n",
|
|||
|
"\n",
|
|||
|
"fuzzy_variables = {\n",
|
|||
|
" \"age\": age,\n",
|
|||
|
" \"ap_hi\": ap_hi,\n",
|
|||
|
" \"cholesterol\": cholesterol,\n",
|
|||
|
" \"bmi\": bmi,\n",
|
|||
|
" \"consequent\": cardio,\n",
|
|||
|
"}\n",
|
|||
|
"fuzzy_rules = get_fuzzy_rules(clustered_rules, fuzzy_variables)\n",
|
|||
|
"\n",
|
|||
|
"fuzzy_cntrl = ctrl.ControlSystem(fuzzy_rules)\n",
|
|||
|
"\n",
|
|||
|
"sim = ctrl.ControlSystemSimulation(fuzzy_cntrl, lenient=False)\n",
|
|||
|
"\n",
|
|||
|
"display(len(fuzzy_rules))\n",
|
|||
|
"fuzzy_rules"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 111,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"name": "stdout",
|
|||
|
"output_type": "stream",
|
|||
|
"text": [
|
|||
|
"=============\n",
|
|||
|
" Antecedents \n",
|
|||
|
"=============\n",
|
|||
|
"Antecedent: ap_hi = 110\n",
|
|||
|
" - low : 0.11397849462365592\n",
|
|||
|
" - average : 0.886021505376344\n",
|
|||
|
" - high : 0.0\n",
|
|||
|
"Antecedent: age = 50.358668\n",
|
|||
|
" - low : 0.0\n",
|
|||
|
" - average : 0.7966947605633802\n",
|
|||
|
" - high : 0.2033052394366198\n",
|
|||
|
"Antecedent: cholesterol = 1\n",
|
|||
|
" - low : 1.0\n",
|
|||
|
" - average : 0.0\n",
|
|||
|
" - high : 0.0\n",
|
|||
|
"Antecedent: bmi = 21.96712\n",
|
|||
|
" - low : 0.8718221321169112\n",
|
|||
|
" - average : 0.12817786788308883\n",
|
|||
|
" - high : 0.0\n",
|
|||
|
"\n",
|
|||
|
"=======\n",
|
|||
|
" Rules \n",
|
|||
|
"=======\n",
|
|||
|
"RULE #0:\n",
|
|||
|
" IF (ap_hi[low] AND age[low]) AND cholesterol[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" (ap_hi[low] AND age[low]) AND cholesterol[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #1:\n",
|
|||
|
" IF (ap_hi[average] AND age[low]) AND cholesterol[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" (ap_hi[average] AND age[low]) AND cholesterol[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #2:\n",
|
|||
|
" IF ((ap_hi[low] AND age[low]) AND cholesterol[average]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" - cholesterol[average] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" ((ap_hi[low] AND age[low]) AND cholesterol[average]) AND bmi[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #3:\n",
|
|||
|
" IF ((ap_hi[low] AND age[low]) AND cholesterol[average]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" - cholesterol[average] : 0.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" ((ap_hi[low] AND age[low]) AND cholesterol[average]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #4:\n",
|
|||
|
" IF ((ap_hi[low] AND age[average]) AND cholesterol[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[average] : 0.7966947605633802\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" ((ap_hi[low] AND age[average]) AND cholesterol[low]) AND bmi[low] = 0.11397849462365592\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.11397849462365592\n",
|
|||
|
"\n",
|
|||
|
"RULE #5:\n",
|
|||
|
" IF ((ap_hi[low] AND age[average]) AND cholesterol[low]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[average] : 0.7966947605633802\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" ((ap_hi[low] AND age[average]) AND cholesterol[low]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #6:\n",
|
|||
|
" IF ((ap_hi[average] AND age[average]) AND cholesterol[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[average] : 0.7966947605633802\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" ((ap_hi[average] AND age[average]) AND cholesterol[low]) AND bmi[low] = 0.7966947605633802\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.7966947605633802\n",
|
|||
|
"\n",
|
|||
|
"RULE #7:\n",
|
|||
|
" IF ((ap_hi[average] AND age[average]) AND cholesterol[low]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[average] : 0.7966947605633802\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" ((ap_hi[average] AND age[average]) AND cholesterol[low]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #8:\n",
|
|||
|
" IF ((ap_hi[average] AND age[high]) AND cholesterol[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" ((ap_hi[average] AND age[high]) AND cholesterol[low]) AND bmi[low] = 0.2033052394366198\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.2033052394366198\n",
|
|||
|
"\n",
|
|||
|
"RULE #9:\n",
|
|||
|
" IF ((ap_hi[low] AND age[high]) AND cholesterol[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" ((ap_hi[low] AND age[high]) AND cholesterol[low]) AND bmi[low] = 0.11397849462365592\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.11397849462365592\n",
|
|||
|
"\n",
|
|||
|
"RULE #10:\n",
|
|||
|
" IF ((ap_hi[low] AND age[high]) AND cholesterol[low]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" ((ap_hi[low] AND age[high]) AND cholesterol[low]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #11:\n",
|
|||
|
" IF ((ap_hi[average] AND age[high]) AND cholesterol[low]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" ((ap_hi[average] AND age[high]) AND cholesterol[low]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #12:\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[low]) AND age[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" ((ap_hi[average] AND cholesterol[low]) AND age[low]) AND bmi[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #13:\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[low]) AND age[low]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" ((ap_hi[average] AND cholesterol[low]) AND age[low]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #14:\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[low]) AND age[average]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - age[average] : 0.7966947605633802\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" ((ap_hi[average] AND cholesterol[low]) AND age[average]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #15:\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[low]) AND age[high]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" ((ap_hi[average] AND cholesterol[low]) AND age[high]) AND bmi[low] = 0.2033052394366198\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.2033052394366198\n",
|
|||
|
"\n",
|
|||
|
"RULE #16:\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[low]) AND age[high]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" ((ap_hi[average] AND cholesterol[low]) AND age[high]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #17:\n",
|
|||
|
" IF (ap_hi[average] AND cholesterol[low]) AND age[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - cholesterol[low] : 1.0\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" (ap_hi[average] AND cholesterol[low]) AND age[high] = 0.2033052394366198\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.2033052394366198\n",
|
|||
|
"\n",
|
|||
|
"RULE #18:\n",
|
|||
|
" IF ((ap_hi[low] AND age[high]) AND cholesterol[high]) AND bmi[low] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" - cholesterol[high] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" ((ap_hi[low] AND age[high]) AND cholesterol[high]) AND bmi[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #19:\n",
|
|||
|
" IF ((ap_hi[low] AND age[high]) AND cholesterol[high]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" - cholesterol[high] : 0.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" ((ap_hi[low] AND age[high]) AND cholesterol[high]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #20:\n",
|
|||
|
" IF (ap_hi[high] AND bmi[low]) AND age[low] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[high] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" (ap_hi[high] AND bmi[low]) AND age[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #21:\n",
|
|||
|
" IF (ap_hi[high] AND bmi[low]) AND age[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[high] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" (ap_hi[high] AND bmi[low]) AND age[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #22:\n",
|
|||
|
" IF (ap_hi[average] AND age[average]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[average] : 0.7966947605633802\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" (ap_hi[average] AND age[average]) AND bmi[low] = 0.7966947605633802\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.7966947605633802\n",
|
|||
|
"\n",
|
|||
|
"RULE #23:\n",
|
|||
|
" IF (ap_hi[average] AND age[low]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" (ap_hi[average] AND age[low]) AND bmi[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #24:\n",
|
|||
|
" IF (ap_hi[average] AND age[low]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" (ap_hi[average] AND age[low]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #25:\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[high]) AND bmi[low]) AND age[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - cholesterol[high] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" ((ap_hi[average] AND cholesterol[high]) AND bmi[low]) AND age[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #26:\n",
|
|||
|
" IF ((ap_hi[average] AND cholesterol[high]) AND bmi[low]) AND age[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - cholesterol[high] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" ((ap_hi[average] AND cholesterol[high]) AND bmi[low]) AND age[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #27:\n",
|
|||
|
" IF (ap_hi[average] AND cholesterol[high]) AND bmi[low] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - cholesterol[high] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" (ap_hi[average] AND cholesterol[high]) AND bmi[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #28:\n",
|
|||
|
" IF (ap_hi[average] AND cholesterol[high]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - cholesterol[high] : 0.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" (ap_hi[average] AND cholesterol[high]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #29:\n",
|
|||
|
" IF (ap_hi[average] AND age[average]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[average] : 0.7966947605633802\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" (ap_hi[average] AND age[average]) AND bmi[low] = 0.7966947605633802\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.7966947605633802\n",
|
|||
|
"\n",
|
|||
|
"RULE #30:\n",
|
|||
|
" IF (ap_hi[average] AND age[average]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[average] : 0.7966947605633802\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" (ap_hi[average] AND age[average]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #31:\n",
|
|||
|
" IF ap_hi[average] AND age[average] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[average] : 0.7966947605633802\n",
|
|||
|
" ap_hi[average] AND age[average] = 0.7966947605633802\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.7966947605633802\n",
|
|||
|
"\n",
|
|||
|
"RULE #32:\n",
|
|||
|
" IF ap_hi[average] AND age[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" ap_hi[average] AND age[high] = 0.2033052394366198\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.2033052394366198\n",
|
|||
|
"\n",
|
|||
|
"RULE #33:\n",
|
|||
|
" IF ((ap_hi[low] AND age[low]) AND cholesterol[high]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" - cholesterol[high] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" ((ap_hi[low] AND age[low]) AND cholesterol[high]) AND bmi[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #34:\n",
|
|||
|
" IF ((ap_hi[average] AND age[low]) AND cholesterol[high]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[average] : 0.886021505376344\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" - cholesterol[high] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" ((ap_hi[average] AND age[low]) AND cholesterol[high]) AND bmi[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #35:\n",
|
|||
|
" IF ((ap_hi[low] AND age[low]) AND cholesterol[high]) AND bmi[high] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" - cholesterol[high] : 0.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" ((ap_hi[low] AND age[low]) AND cholesterol[high]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #36:\n",
|
|||
|
" IF ((ap_hi[low] AND age[average]) AND cholesterol[high]) AND bmi[low] THEN cardio[No]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[average] : 0.7966947605633802\n",
|
|||
|
" - cholesterol[high] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" ((ap_hi[low] AND age[average]) AND cholesterol[high]) AND bmi[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[No] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #37:\n",
|
|||
|
" IF ((ap_hi[low] AND age[average]) AND cholesterol[high]) AND bmi[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[low] : 0.11397849462365592\n",
|
|||
|
" - age[average] : 0.7966947605633802\n",
|
|||
|
" - cholesterol[high] : 0.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" ((ap_hi[low] AND age[average]) AND cholesterol[high]) AND bmi[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #38:\n",
|
|||
|
" IF (ap_hi[high] AND bmi[high]) AND age[low] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[high] : 0.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" - age[low] : 0.0\n",
|
|||
|
" (ap_hi[high] AND bmi[high]) AND age[low] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #39:\n",
|
|||
|
" IF (ap_hi[high] AND bmi[high]) AND age[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[high] : 0.0\n",
|
|||
|
" - bmi[high] : 0.0\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" (ap_hi[high] AND bmi[high]) AND age[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"RULE #40:\n",
|
|||
|
" IF (ap_hi[high] AND bmi[low]) AND age[high] THEN cardio[Yes]\n",
|
|||
|
"\tAND aggregation function : fmin\n",
|
|||
|
"\tOR aggregation function : fmax\n",
|
|||
|
"\n",
|
|||
|
" Aggregation (IF-clause):\n",
|
|||
|
" - ap_hi[high] : 0.0\n",
|
|||
|
" - bmi[low] : 0.8718221321169112\n",
|
|||
|
" - age[high] : 0.2033052394366198\n",
|
|||
|
" (ap_hi[high] AND bmi[low]) AND age[high] = 0.0\n",
|
|||
|
" Activation (THEN-clause):\n",
|
|||
|
" cardio[Yes] : 0.0\n",
|
|||
|
"\n",
|
|||
|
"\n",
|
|||
|
"==============================\n",
|
|||
|
" Intermediaries and Conquests \n",
|
|||
|
"==============================\n",
|
|||
|
"Consequent: cardio = 0.5000000000000001\n",
|
|||
|
" No:\n",
|
|||
|
" Accumulate using accumulation_max : 0.7966947605633802\n",
|
|||
|
" Yes:\n",
|
|||
|
" Accumulate using accumulation_max : 0.7966947605633802\n",
|
|||
|
"\n"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"np.float64(0.5000000000000001)"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"1"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAGyCAYAAAAI3auEAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABtRklEQVR4nO3dd3gU5frG8e+m90ZCAiEkJLTQm/QiilIUREWqVMEKIthABKyAelQUUBSwnaOiIlgRBQQhVKVJ6CUhoSQQSnrf+f2R3+EcDqAkJJlN9v5cV7xkmNm9l0l2n7zvO/NYDMMwEBEREbFDDmYHEBERETGLCiERERGxWyqERERExG6pEBIRERG7pUJIRERE7JYKIREREbFbKoRERETEbqkQEhEREbulQkhERETslt0VQoZhkJaWhm6oLSIiIqYWQuvWraN3795Ur14di8XCN99887fHrF27lhYtWuDq6krt2rX56KOPivWc6enp+Pr6kp6eXrLQIiIiUmmYWghlZmbStGlT5s2bd037x8XFcdttt9G1a1d27tzJY489xujRo/n555/LOKmIiIhURhZbabpqsVhYtmwZffv2veo+Tz/9ND/++COxsbEXtw0cOJALFy6wYsWKa3qetLQ0fH19SU1NxcfH53pji4iISAVWodYIbdq0iW7dul2yrXv37mzatOmqx+Tm5pKWlnbJF8Du4xfKMqqIiIiUlsIC+PXlMnnoClUIJSUlERwcfMm24OBg0tLSyM7OvuIxM2fOxNfX9+JXWFgYAEMXbWXBuqNYrTYxICYiIiJXknoCPu4N618vk4evUIVQSUyePJnU1NSLX4mJiQAMblOTl5fv476Pf+dcZp7JKUVEROQyB36C+R3gQgKM+LFMnqJCFUIhISEkJydfsi05ORkfHx/c3d2veIyrqys+Pj6XfAE81aM+H4xoxc7EC/R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UCqEKYO2B0zz+5S4cHSzMHtCM9rUDzY4kIiIVUX4OrJxadJPE6N7QZw642/fyCxVCFURyWg6PLd7J5rizjOtam0dvroOTOtmLiMi1SjkMS0bAmYPQ/WW4YXSF7RhfmlQIVSCFVoN5aw4ze9VBWoUH8NagZlTzdTc7loiI2LpdX8APE8CnWlGbjGpNzE5kM1QIVUBb487x6Oc7yC0o5B/3NOXm6GCzI4mIiC3KzYDlT8Kuz6DpIOj1D3BVf8v/pkKogjqfmccTX+1i9f7TjOpQi0k96+PipKkyERH5f0mx8NUISDsJt70OzQaZncgmqRCqwAzD4IMN8cz6aR/1Q3yYO7g54VU8zY4lIiJmMgz4YxGseAYC68I9H0JgHbNT2SwNIVRgFouF+zrW4uuH2pOWk89tb8fw3a6TZscSERGzZF+AL4fBj49Di2EwepWKoL+hEaFKIj0nn2eWxfL9rpMMvCGM6b0b4u7iaHYsEREpL8f/gCUjIScV+syFBn3MTlQhqBCqRAzD4IvfE3nu+z3UDPBg7uAW1A32NjuWiIiUJasVNs2B1S9A9eZw9yLwDzc7VYWhqbFKxGKxMLB1Tb4b2xGAPnNj+HxrgjrZi4hUVhln4LN7YOU0aDcWRv6kIqiYNCJUSWXnFfLCD3v4fGsitzepxsy7GuPtpk72IiKVxtHfijrGWwvgrvegdjezE1VIKoQque93nWTy0t0EeLowd3BzmtTwMzuSiIhcj8IC+O0VWPca1OoMd70P3iFmp6qwNDVWyfVuWp0fH+2In4czd7+7kYXrj2qqTESkoko9AR/3hvX/gJumwNBlKoKuk0aE7ERegZVXVuxnUUwcN9evymv3NCXA08XsWCIicq0OrIBvHgJn96IF0eHtzE5UKagQsjOr9yXzxFe7cHVy5K2BzWgTWcXsSCIi8lcK8mDVdNj8DtTrBXf
|
|||
|
"text/plain": [
|
|||
|
"<Figure size 640x480 with 1 Axes>"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"sim.input[\"age\"] = 50.358668\n",
|
|||
|
"sim.input[\"ap_hi\"] = 110\n",
|
|||
|
"sim.input[\"cholesterol\"] = 1\n",
|
|||
|
"sim.input[\"bmi\"] = 21.967120\n",
|
|||
|
"sim.compute()\n",
|
|||
|
"sim.print_state()\n",
|
|||
|
"display(sim.output[\"cardio\"], 1 if sim.output[\"cardio\"] > 0.5 else 0)\n",
|
|||
|
"cardio.view(sim=sim)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 112,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"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>age</th>\n",
|
|||
|
" <th>ap_hi</th>\n",
|
|||
|
" <th>cholesterol</th>\n",
|
|||
|
" <th>bmi</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>id</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>94960</th>\n",
|
|||
|
" <td>62.014018</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>26.892323</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>30807</th>\n",
|
|||
|
" <td>57.745592</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>28.393726</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>26485</th>\n",
|
|||
|
" <td>59.670354</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>23.875115</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>3868</th>\n",
|
|||
|
" <td>49.715256</td>\n",
|
|||
|
" <td>110</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>20.820940</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>45890</th>\n",
|
|||
|
" <td>59.785347</td>\n",
|
|||
|
" <td>160</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>23.529412</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>61975</th>\n",
|
|||
|
" <td>62.558865</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>28.196921</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>32741</th>\n",
|
|||
|
" <td>57.882488</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>29.043709</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>94833</th>\n",
|
|||
|
" <td>51.371701</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>29.242109</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>95660</th>\n",
|
|||
|
" <td>45.767167</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>24.977043</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>81002</th>\n",
|
|||
|
" <td>55.544300</td>\n",
|
|||
|
" <td>150</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>27.053803</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>55188 rows × 4 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" age ap_hi cholesterol bmi\n",
|
|||
|
"id \n",
|
|||
|
"94960 62.014018 120 1 26.892323\n",
|
|||
|
"30807 57.745592 120 1 28.393726\n",
|
|||
|
"26485 59.670354 120 3 23.875115\n",
|
|||
|
"3868 49.715256 110 1 20.820940\n",
|
|||
|
"45890 59.785347 160 1 23.529412\n",
|
|||
|
"... ... ... ... ...\n",
|
|||
|
"61975 62.558865 120 1 28.196921\n",
|
|||
|
"32741 57.882488 120 1 29.043709\n",
|
|||
|
"94833 51.371701 120 1 29.242109\n",
|
|||
|
"95660 45.767167 120 1 24.977043\n",
|
|||
|
"81002 55.544300 150 1 27.053803\n",
|
|||
|
"\n",
|
|||
|
"[55188 rows x 4 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"id\n",
|
|||
|
"94960 0\n",
|
|||
|
"30807 0\n",
|
|||
|
"26485 0\n",
|
|||
|
"3868 1\n",
|
|||
|
"45890 1\n",
|
|||
|
" ..\n",
|
|||
|
"61975 1\n",
|
|||
|
"32741 0\n",
|
|||
|
"94833 0\n",
|
|||
|
"95660 0\n",
|
|||
|
"81002 1\n",
|
|||
|
"Name: cardio, Length: 55188, dtype: int64"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"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>age</th>\n",
|
|||
|
" <th>ap_hi</th>\n",
|
|||
|
" <th>cholesterol</th>\n",
|
|||
|
" <th>bmi</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>id</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>42270</th>\n",
|
|||
|
" <td>60.078305</td>\n",
|
|||
|
" <td>140</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>45.918367</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>10780</th>\n",
|
|||
|
" <td>55.360859</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>24.998904</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>42436</th>\n",
|
|||
|
" <td>48.198445</td>\n",
|
|||
|
" <td>100</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>21.926126</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>88647</th>\n",
|
|||
|
" <td>41.517906</td>\n",
|
|||
|
" <td>130</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>27.764650</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>62336</th>\n",
|
|||
|
" <td>51.692038</td>\n",
|
|||
|
" <td>110</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>22.230987</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>30330</th>\n",
|
|||
|
" <td>47.697404</td>\n",
|
|||
|
" <td>100</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>22.724403</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>62907</th>\n",
|
|||
|
" <td>58.597087</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>23.828125</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>98612</th>\n",
|
|||
|
" <td>51.404556</td>\n",
|
|||
|
" <td>110</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>22.589551</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>5767</th>\n",
|
|||
|
" <td>62.033184</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>23.875115</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>14769</th>\n",
|
|||
|
" <td>41.506954</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>22.948116</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>13797 rows × 4 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" age ap_hi cholesterol bmi\n",
|
|||
|
"id \n",
|
|||
|
"42270 60.078305 140 1 45.918367\n",
|
|||
|
"10780 55.360859 120 2 24.998904\n",
|
|||
|
"42436 48.198445 100 3 21.926126\n",
|
|||
|
"88647 41.517906 130 2 27.764650\n",
|
|||
|
"62336 51.692038 110 1 22.230987\n",
|
|||
|
"... ... ... ... ...\n",
|
|||
|
"30330 47.697404 100 1 22.724403\n",
|
|||
|
"62907 58.597087 120 1 23.828125\n",
|
|||
|
"98612 51.404556 110 1 22.589551\n",
|
|||
|
"5767 62.033184 120 1 23.875115\n",
|
|||
|
"14769 41.506954 120 2 22.948116\n",
|
|||
|
"\n",
|
|||
|
"[13797 rows x 4 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"id\n",
|
|||
|
"42270 1\n",
|
|||
|
"10780 0\n",
|
|||
|
"42436 1\n",
|
|||
|
"88647 1\n",
|
|||
|
"62336 0\n",
|
|||
|
" ..\n",
|
|||
|
"30330 1\n",
|
|||
|
"62907 0\n",
|
|||
|
"98612 0\n",
|
|||
|
"5767 0\n",
|
|||
|
"14769 1\n",
|
|||
|
"Name: cardio, Length: 13797, dtype: int64"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from sklearn.model_selection import train_test_split\n",
|
|||
|
"\n",
|
|||
|
"random_state = 9\n",
|
|||
|
"\n",
|
|||
|
"def fuzzy_pred(row):\n",
|
|||
|
" sim.input[\"age\"] = row[\"age\"]\n",
|
|||
|
" sim.input[\"ap_hi\"] = row[\"ap_hi\"]\n",
|
|||
|
" sim.input[\"cholesterol\"] = row[\"cholesterol\"]\n",
|
|||
|
" sim.input[\"bmi\"] = row[\"bmi\"]\n",
|
|||
|
" sim.compute()\n",
|
|||
|
" return 1 if sim.output[\"cardio\"] > 0.5 else 0\n",
|
|||
|
"\n",
|
|||
|
"y = df[\"cardio\"]\n",
|
|||
|
"X = df.drop([\"cardio\"], axis=1).copy()\n",
|
|||
|
"X_train, X_test, y_train, y_test = train_test_split(\n",
|
|||
|
" X, y, test_size=0.2, random_state=random_state\n",
|
|||
|
")\n",
|
|||
|
"display(X_train, y_train, X_test, y_test)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 113,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"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>age</th>\n",
|
|||
|
" <th>ap_hi</th>\n",
|
|||
|
" <th>cholesterol</th>\n",
|
|||
|
" <th>bmi</th>\n",
|
|||
|
" <th>Real</th>\n",
|
|||
|
" <th>Inferred</th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>id</th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" <th></th>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </thead>\n",
|
|||
|
" <tbody>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>42270</th>\n",
|
|||
|
" <td>60.078305</td>\n",
|
|||
|
" <td>140</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>45.918367</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>10780</th>\n",
|
|||
|
" <td>55.360859</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>24.998904</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>42436</th>\n",
|
|||
|
" <td>48.198445</td>\n",
|
|||
|
" <td>100</td>\n",
|
|||
|
" <td>3</td>\n",
|
|||
|
" <td>21.926126</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>88647</th>\n",
|
|||
|
" <td>41.517906</td>\n",
|
|||
|
" <td>130</td>\n",
|
|||
|
" <td>2</td>\n",
|
|||
|
" <td>27.764650</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>62336</th>\n",
|
|||
|
" <td>51.692038</td>\n",
|
|||
|
" <td>110</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>22.230987</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>...</th>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" <td>...</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>23904</th>\n",
|
|||
|
" <td>53.942613</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>35.491690</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>63516</th>\n",
|
|||
|
" <td>40.305005</td>\n",
|
|||
|
" <td>120</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>21.829952</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>84904</th>\n",
|
|||
|
" <td>42.561056</td>\n",
|
|||
|
" <td>140</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>32.882414</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>20959</th>\n",
|
|||
|
" <td>45.545395</td>\n",
|
|||
|
" <td>160</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>43.827160</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" <tr>\n",
|
|||
|
" <th>77652</th>\n",
|
|||
|
" <td>54.115102</td>\n",
|
|||
|
" <td>140</td>\n",
|
|||
|
" <td>1</td>\n",
|
|||
|
" <td>37.105751</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" <td>0</td>\n",
|
|||
|
" </tr>\n",
|
|||
|
" </tbody>\n",
|
|||
|
"</table>\n",
|
|||
|
"<p>1000 rows × 6 columns</p>\n",
|
|||
|
"</div>"
|
|||
|
],
|
|||
|
"text/plain": [
|
|||
|
" age ap_hi cholesterol bmi Real Inferred\n",
|
|||
|
"id \n",
|
|||
|
"42270 60.078305 140 1 45.918367 1 1\n",
|
|||
|
"10780 55.360859 120 2 24.998904 0 0\n",
|
|||
|
"42436 48.198445 100 3 21.926126 1 0\n",
|
|||
|
"88647 41.517906 130 2 27.764650 1 0\n",
|
|||
|
"62336 51.692038 110 1 22.230987 0 0\n",
|
|||
|
"... ... ... ... ... ... ...\n",
|
|||
|
"23904 53.942613 120 1 35.491690 1 0\n",
|
|||
|
"63516 40.305005 120 1 21.829952 0 0\n",
|
|||
|
"84904 42.561056 140 1 32.882414 1 0\n",
|
|||
|
"20959 45.545395 160 1 43.827160 1 0\n",
|
|||
|
"77652 54.115102 140 1 37.105751 0 0\n",
|
|||
|
"\n",
|
|||
|
"[1000 rows x 6 columns]"
|
|||
|
]
|
|||
|
},
|
|||
|
"execution_count": 113,
|
|||
|
"metadata": {},
|
|||
|
"output_type": "execute_result"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"result_test = X_test.copy()\n",
|
|||
|
"result_test[\"Real\"] = y_test\n",
|
|||
|
"result_test = result_test.head(1000)\n",
|
|||
|
"result_test[\"Inferred\"] = result_test.apply(fuzzy_pred, axis=1)\n",
|
|||
|
"result_test"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": 114,
|
|||
|
"metadata": {},
|
|||
|
"outputs": [
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"'Precision_test'"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"np.float64(0.5469483568075117)"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"'Recall_test'"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"np.float64(0.4707070707070707)"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"'Accuracy_test'"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"0.545"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"'F1_test'"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"np.float64(0.505971769815418)"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"'Confusion_matrix'"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
},
|
|||
|
{
|
|||
|
"data": {
|
|||
|
"text/plain": [
|
|||
|
"array([[312, 193],\n",
|
|||
|
" [262, 233]])"
|
|||
|
]
|
|||
|
},
|
|||
|
"metadata": {},
|
|||
|
"output_type": "display_data"
|
|||
|
}
|
|||
|
],
|
|||
|
"source": [
|
|||
|
"from sklearn import metrics\n",
|
|||
|
"\n",
|
|||
|
"display(\n",
|
|||
|
" \"Precision_test\",\n",
|
|||
|
" metrics.precision_score(result_test[\"Real\"], result_test[\"Inferred\"]),\n",
|
|||
|
")\n",
|
|||
|
"display(\n",
|
|||
|
" \"Recall_test\", metrics.recall_score(result_test[\"Real\"], result_test[\"Inferred\"])\n",
|
|||
|
")\n",
|
|||
|
"display(\n",
|
|||
|
" \"Accuracy_test\",\n",
|
|||
|
" metrics.accuracy_score(result_test[\"Real\"], result_test[\"Inferred\"]),\n",
|
|||
|
")\n",
|
|||
|
"display(\n",
|
|||
|
" \"F1_test\", \n",
|
|||
|
" metrics.f1_score(result_test[\"Real\"], result_test[\"Inferred\"]),\n",
|
|||
|
")\n",
|
|||
|
"display(\n",
|
|||
|
" \"Confusion_matrix\",\n",
|
|||
|
" metrics.confusion_matrix(result_test[\"Real\"], result_test[\"Inferred\"]),\n",
|
|||
|
")"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"metadata": {
|
|||
|
"kernelspec": {
|
|||
|
"display_name": ".venv",
|
|||
|
"language": "python",
|
|||
|
"name": "python3"
|
|||
|
},
|
|||
|
"language_info": {
|
|||
|
"codemirror_mode": {
|
|||
|
"name": "ipython",
|
|||
|
"version": 3
|
|||
|
},
|
|||
|
"file_extension": ".py",
|
|||
|
"mimetype": "text/x-python",
|
|||
|
"name": "python",
|
|||
|
"nbconvert_exporter": "python",
|
|||
|
"pygments_lexer": "ipython3",
|
|||
|
"version": "3.12.9"
|
|||
|
}
|
|||
|
},
|
|||
|
"nbformat": 4,
|
|||
|
"nbformat_minor": 2
|
|||
|
}
|