1700 lines
287 KiB
Plaintext
1700 lines
287 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"|--- Al2O3 <= 0.18\n",
|
||
|
"| |--- TiO2 <= 0.18\n",
|
||
|
"| | |--- T <= 32.50\n",
|
||
|
"| | | |--- TiO2 <= 0.03\n",
|
||
|
"| | | | |--- Al2O3 <= 0.03\n",
|
||
|
"| | | | | |--- T <= 22.50\n",
|
||
|
"| | | | | | |--- value: [1.06]\n",
|
||
|
"| | | | | |--- T > 22.50\n",
|
||
|
"| | | | | | |--- value: [1.06]\n",
|
||
|
"| | | | |--- Al2O3 > 0.03\n",
|
||
|
"| | | | | |--- value: [1.09]\n",
|
||
|
"| | | |--- TiO2 > 0.03\n",
|
||
|
"| | | | |--- T <= 27.50\n",
|
||
|
"| | | | | |--- T <= 22.50\n",
|
||
|
"| | | | | | |--- value: [1.09]\n",
|
||
|
"| | | | | |--- T > 22.50\n",
|
||
|
"| | | | | | |--- value: [1.09]\n",
|
||
|
"| | | | |--- T > 27.50\n",
|
||
|
"| | | | | |--- value: [1.08]\n",
|
||
|
"| | |--- T > 32.50\n",
|
||
|
"| | | |--- TiO2 <= 0.03\n",
|
||
|
"| | | | |--- Al2O3 <= 0.03\n",
|
||
|
"| | | | | |--- T <= 55.00\n",
|
||
|
"| | | | | | |--- T <= 47.50\n",
|
||
|
"| | | | | | | |--- value: [1.05]\n",
|
||
|
"| | | | | | |--- T > 47.50\n",
|
||
|
"| | | | | | | |--- value: [1.04]\n",
|
||
|
"| | | | | |--- T > 55.00\n",
|
||
|
"| | | | | | |--- T <= 62.50\n",
|
||
|
"| | | | | | | |--- value: [1.04]\n",
|
||
|
"| | | | | | |--- T > 62.50\n",
|
||
|
"| | | | | | | |--- value: [1.03]\n",
|
||
|
"| | | | |--- Al2O3 > 0.03\n",
|
||
|
"| | | | | |--- T <= 60.00\n",
|
||
|
"| | | | | | |--- T <= 52.50\n",
|
||
|
"| | | | | | | |--- value: [1.07]\n",
|
||
|
"| | | | | | |--- T > 52.50\n",
|
||
|
"| | | | | | | |--- value: [1.06]\n",
|
||
|
"| | | | | |--- T > 60.00\n",
|
||
|
"| | | | | | |--- T <= 67.50\n",
|
||
|
"| | | | | | | |--- value: [1.06]\n",
|
||
|
"| | | | | | |--- T > 67.50\n",
|
||
|
"| | | | | | | |--- value: [1.05]\n",
|
||
|
"| | | |--- TiO2 > 0.03\n",
|
||
|
"| | | | |--- T <= 50.00\n",
|
||
|
"| | | | | |--- T <= 37.50\n",
|
||
|
"| | | | | | |--- value: [1.08]\n",
|
||
|
"| | | | | |--- T > 37.50\n",
|
||
|
"| | | | | | |--- value: [1.08]\n",
|
||
|
"| | | | |--- T > 50.00\n",
|
||
|
"| | | | | |--- T <= 67.50\n",
|
||
|
"| | | | | | |--- T <= 62.50\n",
|
||
|
"| | | | | | | |--- value: [1.06]\n",
|
||
|
"| | | | | | |--- T > 62.50\n",
|
||
|
"| | | | | | | |--- value: [1.06]\n",
|
||
|
"| | | | | |--- T > 67.50\n",
|
||
|
"| | | | | | |--- value: [1.06]\n",
|
||
|
"| |--- TiO2 > 0.18\n",
|
||
|
"| | |--- T <= 40.00\n",
|
||
|
"| | | |--- T <= 30.00\n",
|
||
|
"| | | | |--- value: [1.22]\n",
|
||
|
"| | | |--- T > 30.00\n",
|
||
|
"| | | | |--- value: [1.21]\n",
|
||
|
"| | |--- T > 40.00\n",
|
||
|
"| | | |--- T <= 60.00\n",
|
||
|
"| | | | |--- T <= 52.50\n",
|
||
|
"| | | | | |--- T <= 47.50\n",
|
||
|
"| | | | | | |--- value: [1.20]\n",
|
||
|
"| | | | | |--- T > 47.50\n",
|
||
|
"| | | | | | |--- value: [1.19]\n",
|
||
|
"| | | | |--- T > 52.50\n",
|
||
|
"| | | | | |--- value: [1.19]\n",
|
||
|
"| | | |--- T > 60.00\n",
|
||
|
"| | | | |--- value: [1.18]\n",
|
||
|
"|--- Al2O3 > 0.18\n",
|
||
|
"| |--- T <= 35.00\n",
|
||
|
"| | |--- T <= 22.50\n",
|
||
|
"| | | |--- value: [1.19]\n",
|
||
|
"| | |--- T > 22.50\n",
|
||
|
"| | | |--- T <= 27.50\n",
|
||
|
"| | | | |--- value: [1.18]\n",
|
||
|
"| | | |--- T > 27.50\n",
|
||
|
"| | | | |--- value: [1.18]\n",
|
||
|
"| |--- T > 35.00\n",
|
||
|
"| | |--- T <= 52.50\n",
|
||
|
"| | | |--- T <= 42.50\n",
|
||
|
"| | | | |--- value: [1.17]\n",
|
||
|
"| | | |--- T > 42.50\n",
|
||
|
"| | | | |--- T <= 47.50\n",
|
||
|
"| | | | | |--- value: [1.17]\n",
|
||
|
"| | | | |--- T > 47.50\n",
|
||
|
"| | | | | |--- value: [1.16]\n",
|
||
|
"| | |--- T > 52.50\n",
|
||
|
"| | | |--- T <= 65.00\n",
|
||
|
"| | | | |--- T <= 57.50\n",
|
||
|
"| | | | | |--- value: [1.16]\n",
|
||
|
"| | | | |--- T > 57.50\n",
|
||
|
"| | | | | |--- value: [1.15]\n",
|
||
|
"| | | |--- T > 65.00\n",
|
||
|
"| | | | |--- value: [1.14]\n",
|
||
|
"\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import pickle\n",
|
||
|
"import pandas as pd\n",
|
||
|
"from sklearn import tree\n",
|
||
|
"\n",
|
||
|
"model = pickle.load(open(\"data/dtree.model.sav\", \"rb\"))\n",
|
||
|
"features = (\n",
|
||
|
" pd.read_csv(\"data/density_train.csv\", sep=\";\", decimal=\",\")\n",
|
||
|
" .drop([\"Density\"], 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": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"34"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 <= 0.025) and (Al2O3 <= 0.025) and (T > 55.0) and (T > 62.5) -> 1.033,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 <= 0.025) and (Al2O3 <= 0.025) and (T > 55.0) and (T <= 62.5) -> 1.038,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 <= 0.025) and (Al2O3 <= 0.025) and (T <= 55.0) and (T > 47.5) -> 1.045,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 <= 0.025) and (Al2O3 <= 0.025) and (T <= 55.0) and (T <= 47.5) -> 1.051,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 <= 0.025) and (Al2O3 > 0.025) and (T > 60.0) and (T > 67.5) -> 1.053,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 > 0.025) and (T > 50.0) and (T > 67.5) -> 1.056,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 <= 0.025) and (Al2O3 > 0.025) and (T > 60.0) and (T <= 67.5) -> 1.057,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) and (TiO2 <= 0.025) and (Al2O3 <= 0.025) and (T > 22.5) -> 1.06,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 > 0.025) and (T > 50.0) and (T <= 67.5) and (T > 62.5) -> 1.06,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) and (TiO2 <= 0.025) and (Al2O3 <= 0.025) and (T <= 22.5) -> 1.062,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 > 0.025) and (T > 50.0) and (T <= 67.5) and (T <= 62.5) -> 1.064,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 <= 0.025) and (Al2O3 > 0.025) and (T <= 60.0) and (T > 52.5) -> 1.064,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 <= 0.025) and (Al2O3 > 0.025) and (T <= 60.0) and (T <= 52.5) -> 1.069,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 > 0.025) and (T <= 50.0) and (T > 37.5) -> 1.078,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (TiO2 > 0.025) and (T <= 50.0) and (T <= 37.5) -> 1.081,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) and (TiO2 > 0.025) and (T > 27.5) -> 1.084,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) and (TiO2 <= 0.025) and (Al2O3 > 0.025) -> 1.088,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) and (TiO2 > 0.025) and (T <= 27.5) and (T > 22.5) -> 1.088,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) and (TiO2 > 0.025) and (T <= 27.5) and (T <= 22.5) -> 1.091,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T > 52.5) and (T > 65.0) -> 1.144,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T > 52.5) and (T <= 65.0) and (T > 57.5) -> 1.152,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T > 52.5) and (T <= 65.0) and (T <= 57.5) -> 1.157,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T <= 52.5) and (T > 42.5) and (T > 47.5) -> 1.161,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T <= 52.5) and (T > 42.5) and (T <= 47.5) -> 1.166,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T <= 52.5) and (T <= 42.5) -> 1.17,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) and (T > 60.0) -> 1.178,\n",
|
||
|
" if (Al2O3 > 0.175) and (T <= 35.0) and (T > 22.5) and (T > 27.5) -> 1.179,\n",
|
||
|
" if (Al2O3 > 0.175) and (T <= 35.0) and (T > 22.5) and (T <= 27.5) -> 1.184,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) and (T <= 60.0) and (T > 52.5) -> 1.187,\n",
|
||
|
" if (Al2O3 > 0.175) and (T <= 35.0) and (T <= 22.5) -> 1.189,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) and (T <= 60.0) and (T <= 52.5) and (T > 47.5) -> 1.193,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) and (T <= 60.0) and (T <= 52.5) and (T <= 47.5) -> 1.198,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T <= 40.0) and (T > 30.0) -> 1.208,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T <= 40.0) and (T <= 30.0) -> 1.219]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from src.rules import get_rules\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"rules = get_rules(model, features)\n",
|
||
|
"display(len(rules))\n",
|
||
|
"rules"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"34"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) -> 1.033,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 62.5) -> 1.038,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 55.0) -> 1.045,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 55.0) -> 1.051,\n",
|
||
|
" if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T > 32.5) -> 1.053,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) -> 1.056,\n",
|
||
|
" if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 67.5) -> 1.057,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) and (T > 22.5) -> 1.06,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) and (T <= 67.5) -> 1.06,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) -> 1.062,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) and (T <= 67.5) -> 1.064,\n",
|
||
|
" if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 60.0) -> 1.064,\n",
|
||
|
" if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 60.0) -> 1.069,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) and (T <= 50.0) -> 1.078,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) and (T <= 50.0) -> 1.081,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T <= 32.5) and (T > 27.5) -> 1.084,\n",
|
||
|
" if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T <= 32.5) -> 1.088,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T <= 32.5) and (T > 22.5) -> 1.088,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T <= 32.5) -> 1.091,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) -> 1.144,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T <= 65.0) -> 1.152,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T <= 65.0) -> 1.157,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T <= 52.5) -> 1.161,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T <= 52.5) -> 1.166,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T <= 52.5) -> 1.17,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) -> 1.178,\n",
|
||
|
" if (Al2O3 > 0.175) and (T <= 35.0) and (T > 22.5) -> 1.179,\n",
|
||
|
" if (Al2O3 > 0.175) and (T <= 35.0) and (T > 22.5) -> 1.184,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) and (T <= 60.0) -> 1.187,\n",
|
||
|
" if (Al2O3 > 0.175) and (T <= 35.0) -> 1.189,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) and (T <= 60.0) -> 1.193,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) and (T <= 60.0) -> 1.198,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T <= 40.0) and (T > 30.0) -> 1.208,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T <= 40.0) -> 1.219]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 3,
|
||
|
"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": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"24"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) -> 1.033,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 62.5) -> 1.038,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 55.0) -> 1.048,\n",
|
||
|
" if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T > 32.5) -> 1.053,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) -> 1.056,\n",
|
||
|
" if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 67.5) -> 1.057,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) and (T > 22.5) -> 1.06,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) -> 1.062,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) and (T <= 67.5) -> 1.062,\n",
|
||
|
" if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 60.0) -> 1.067,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) and (T <= 50.0) -> 1.079,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T <= 32.5) and (T > 27.5) -> 1.084,\n",
|
||
|
" if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T <= 32.5) -> 1.088,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T <= 32.5) and (T > 22.5) -> 1.088,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T <= 32.5) -> 1.091,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) -> 1.144,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T <= 65.0) -> 1.155,\n",
|
||
|
" if (Al2O3 > 0.175) and (T > 35.0) and (T <= 52.5) -> 1.166,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) -> 1.178,\n",
|
||
|
" if (Al2O3 > 0.175) and (T <= 35.0) and (T > 22.5) -> 1.182,\n",
|
||
|
" if (Al2O3 > 0.175) and (T <= 35.0) -> 1.189,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) and (T <= 60.0) -> 1.193,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T <= 40.0) and (T > 30.0) -> 1.208,\n",
|
||
|
" if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T <= 40.0) -> 1.219]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 4,
|
||
|
"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": 5,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"['(Al2O3 <= 0.175)', '(Al2O3 > 0.025)', '(Al2O3 > 0.175)', '(TiO2 <= 0.175)', '(TiO2 > 0.025)', '(TiO2 > 0.175)']\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>(Al2O3 <= 0.175)</th>\n",
|
||
|
" <th>(Al2O3 > 0.025)</th>\n",
|
||
|
" <th>(Al2O3 > 0.175)</th>\n",
|
||
|
" <th>(TiO2 <= 0.175)</th>\n",
|
||
|
" <th>(TiO2 > 0.025)</th>\n",
|
||
|
" <th>(TiO2 > 0.175)</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",
|
||
|
" </tr>\n",
|
||
|
" </thead>\n",
|
||
|
" <tbody>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) -> 1.033</th>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>1.0333299999999999</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 62.5) -> 1.038</th>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>1.03826</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 55.0) -> 1.048</th>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>1.0478999999999998</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T > 32.5) -> 1.053</th>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>1.05291</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) -> 1.056</th>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>1</td>\n",
|
||
|
" <td>0</td>\n",
|
||
|
" <td>1.05601</td>\n",
|
||
|
" </tr>\n",
|
||
|
" </tbody>\n",
|
||
|
"</table>\n",
|
||
|
"</div>"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
" (Al2O3 <= 0.175) \\\n",
|
||
|
"rule \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 1 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 1 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 1 \n",
|
||
|
"if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (Ti... 1 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (Ti... 1 \n",
|
||
|
"\n",
|
||
|
" (Al2O3 > 0.025) \\\n",
|
||
|
"rule \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (Ti... 1 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (Ti... 0 \n",
|
||
|
"\n",
|
||
|
" (Al2O3 > 0.175) \\\n",
|
||
|
"rule \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (Ti... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (Ti... 0 \n",
|
||
|
"\n",
|
||
|
" (TiO2 <= 0.175) \\\n",
|
||
|
"rule \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 1 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 1 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 1 \n",
|
||
|
"if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (Ti... 1 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (Ti... 1 \n",
|
||
|
"\n",
|
||
|
" (TiO2 > 0.025) \\\n",
|
||
|
"rule \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (Ti... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (Ti... 1 \n",
|
||
|
"\n",
|
||
|
" (TiO2 > 0.175) \\\n",
|
||
|
"rule \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (Ti... 0 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (Ti... 0 \n",
|
||
|
"\n",
|
||
|
" consequent \n",
|
||
|
"rule \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 1.0333299999999999 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 1.03826 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T ... 1.0478999999999998 \n",
|
||
|
"if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (Ti... 1.05291 \n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (Ti... 1.05601 "
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 5,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from src.rules import get_features, vectorize_rules\n",
|
||
|
"\n",
|
||
|
"features = get_features(rules, [\"T\"])\n",
|
||
|
"print(features)\n",
|
||
|
"\n",
|
||
|
"df_rules = vectorize_rules(rules, features)\n",
|
||
|
"df_rules.head(5)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"c:\\Users\\user\\Projects\\python\\fuzzy\\.venv\\Lib\\site-packages\\sklearn\\base.py:1473: ConvergenceWarning: Number of distinct clusters (5) found smaller than n_clusters (6). Possibly due to duplicate points in X.\n",
|
||
|
" return fit_method(estimator, *args, **kwargs)\n",
|
||
|
"c:\\Users\\user\\Projects\\python\\fuzzy\\.venv\\Lib\\site-packages\\sklearn\\base.py:1473: ConvergenceWarning: Number of distinct clusters (5) found smaller than n_clusters (7). Possibly due to duplicate points in X.\n",
|
||
|
" return fit_method(estimator, *args, **kwargs)\n",
|
||
|
"c:\\Users\\user\\Projects\\python\\fuzzy\\.venv\\Lib\\site-packages\\sklearn\\base.py:1473: ConvergenceWarning: Number of distinct clusters (5) found smaller than n_clusters (8). Possibly due to duplicate points in X.\n",
|
||
|
" return fit_method(estimator, *args, **kwargs)\n",
|
||
|
"c:\\Users\\user\\Projects\\python\\fuzzy\\.venv\\Lib\\site-packages\\sklearn\\base.py:1473: ConvergenceWarning: Number of distinct clusters (5) found smaller than n_clusters (9). Possibly due to duplicate points in X.\n",
|
||
|
" return fit_method(estimator, *args, **kwargs)\n",
|
||
|
"c:\\Users\\user\\Projects\\python\\fuzzy\\.venv\\Lib\\site-packages\\sklearn\\base.py:1473: ConvergenceWarning: Number of distinct clusters (5) found smaller than n_clusters (10). Possibly due to duplicate points in X.\n",
|
||
|
" return fit_method(estimator, *args, **kwargs)\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"{2: 0.5483575964237912,\n",
|
||
|
" 3: 0.602943554055511,\n",
|
||
|
" 4: 0.8221763769597347,\n",
|
||
|
" 5: 1.0,\n",
|
||
|
" 6: 1.0,\n",
|
||
|
" 7: 1.0,\n",
|
||
|
" 8: 1.0,\n",
|
||
|
" 9: 1.0,\n",
|
||
|
" 10: 1.0}"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAGFCAYAAAAYU4NfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA8OElEQVR4nO3de1xTdeMH8M8YclG5eOOioiBqqCggivcHSpTUvFbaT1Okx8qyUvGpRPOWFVlpdrHI8vI8pUWalpqXCMEkBVOwNA1R8ZIKXgGFBNm+vz9OW05AN912tsPn/Xrt5XZ2tn025ePhe86+RyWEECAiIkVykDsAERFZDkueiEjBWPJERArGkiciUjCWPBGRgrHkiYgUjCVPRKRgLHkiIgVjyRMRKRhLnoySnp4OlUqFtWvXyh1Fb/z48fD39zdYplKpMHfuXP3tuXPnQqVS4eLFi9YNR2QjWPK1mEqlMuqSnp5u1VwXLlzA5MmTERQUBFdXV3h5eSEiIgIvv/wyrl27ZtUs1lBWVoa5c+dW+zlv3rzZ4D8tIlM5yh2A5PP5558b3P7f//6HlJSUKsvbtWuHw4cPWyXT5cuX0aVLF5SUlOCJJ55AUFAQLl26hN9++w0ff/wxnnnmGdSvXx8A8Omnn0Kr1VollyWVlZVh3rx5AICoqCiD+zZv3owlS5aw6OmuseRrsccff9zgdmZmJlJSUqosB2C1kl+2bBlOnTqFn3/+GT179jS4r6SkBE5OTvrbderUsUomsozS0lLUq1dP7hiKx+EaMolWq8Xrr7+O5s2bw8XFBX379sXRo0errJeVlYUHH3wQHh4eqFu3LiIjI/Hzzz/f8fmPHTsGtVqN7t27V7nP3d0dLi4u+tvVjcnXpKioCOPHj4enpyc8PDwQFxeHsrIyg3UqKysxf/58BAYGwtnZGf7+/pgxYwbKy8sN1rt13F/H398f48ePr/K6U6ZMgZ+fH5ydnd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kdi9eze2bdtW5fWKiopQWVkJAPqjTG79jwOA/jjyW+8bOXIkNBoN5s+fX+UxlZWV1T6XTllZGa5fv26wLDAwEG5ubvrDRfv37w83NzckJiZWWVf320+XLl3g5eWFpKQkg8NMt2zZgsOHDxt8ZjW5l/dBxuGWPJmVg4MDPvvsMwwYMAAdOnRAXFwcmjVrhjNnziAtLQ3u7u7YuHFjjY///PPPsWrVKgwfPhzh4eFwcnLC4cOHsXz5cri4uGDGjBkWyR0SEoLY2FgsXboURUVFiIyMxJ49e/Df//4Xw4YNw/33369fd8KECZg4cSIefvhh9OvXD7/++iu2bduGxo0bGzzniy++iA0bNuChhx7C+PHjER4ejtLSUhw4cABr167FiRMn0LhxY7i6uqJ9+/ZITk5G27Zt0bBhQwQHByM4OBjh4eEAgBdeeAExMTFQq9V47LHHEBkZiaeffhqJiYnYv38/+vfvjzp16iAvLw9r1qzBe++9h0ceeaTa93rkyBH07dsXI0eORPv27eHo6Ij169ejsLAQjz32GADpN7F3330XEyZMQNeuXTF69Gg0aNAAv/76K8rKyvDf//4XderUwYIFCxAXF4fIyEj83//9n/4QSn9/f0ydOvWOn/u9vA8ykrwH95AtMeYQyjVr1hgsz8/PFwDEihUrDJbn5OSIESNGiEaNGglnZ2fRsmVLMXLkSJGamnrbDL/99pt48cUXRefOnUXDhg2Fo6Oj8PX1FY8++qjIzs42WNeUQygvXLhgsN6KFSsEAJGfn69fduPGDTFv3jwREBAg6tSpI/z8/ERCQoK4fv26wWM1Go14+eWXRePGjUXdunVFTEyMOHr0aJVDKIUQ4urVqyIhIUG0bt1aODk5icaNG4uePXuKd95
|
||
|
"text/plain": [
|
||
|
"<Figure size 400x400 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"'The best clusters count is 5'"
|
||
|
]
|
||
|
},
|
||
|
"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": 7,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Кластер 1 (5):\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) -> 1.033;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 62.5) -> 1.038;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 55.0) -> 1.048;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) and (T > 22.5) -> 1.06;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (T <= 32.5) -> 1.062\n",
|
||
|
"--------\n",
|
||
|
"Кластер 2 (5):\n",
|
||
|
"if (Al2O3 > 0.175) and (T > 35.0) -> 1.144;\n",
|
||
|
"if (Al2O3 > 0.175) and (T > 35.0) and (T <= 65.0) -> 1.155;\n",
|
||
|
"if (Al2O3 > 0.175) and (T > 35.0) and (T <= 52.5) -> 1.166;\n",
|
||
|
"if (Al2O3 > 0.175) and (T <= 35.0) and (T > 22.5) -> 1.182;\n",
|
||
|
"if (Al2O3 > 0.175) and (T <= 35.0) -> 1.189\n",
|
||
|
"--------\n",
|
||
|
"Кластер 3 (6):\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) -> 1.056;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) and (T <= 67.5) -> 1.062;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T > 32.5) and (T <= 50.0) -> 1.079;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T <= 32.5) and (T > 27.5) -> 1.084;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T <= 32.5) and (T > 22.5) -> 1.088;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 <= 0.175) and (TiO2 > 0.025) and (T <= 32.5) -> 1.091\n",
|
||
|
"--------\n",
|
||
|
"Кластер 4 (4):\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) -> 1.178;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T > 40.0) and (T <= 60.0) -> 1.193;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T <= 40.0) and (T > 30.0) -> 1.208;\n",
|
||
|
"if (Al2O3 <= 0.175) and (TiO2 > 0.175) and (T <= 40.0) -> 1.219\n",
|
||
|
"--------\n",
|
||
|
"Кластер 5 (4):\n",
|
||
|
"if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T > 32.5) -> 1.053;\n",
|
||
|
"if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 67.5) -> 1.057;\n",
|
||
|
"if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T > 32.5) and (T <= 60.0) -> 1.067;\n",
|
||
|
"if (Al2O3 <= 0.175) and (Al2O3 > 0.025) and (TiO2 <= 0.175) and (T <= 32.5) -> 1.088\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": 8,
|
||
|
"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>T</th>\n",
|
||
|
" <th>Al2O3</th>\n",
|
||
|
" <th>TiO2</th>\n",
|
||
|
" <th>Density</th>\n",
|
||
|
" </tr>\n",
|
||
|
" </thead>\n",
|
||
|
" <tbody>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>0</th>\n",
|
||
|
" <td>20</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.06250</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>1</th>\n",
|
||
|
" <td>25</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.05979</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>2</th>\n",
|
||
|
" <td>35</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.05404</td>\n",
|
||
|
" </tr>\n",
|
||
|
" </tbody>\n",
|
||
|
"</table>\n",
|
||
|
"</div>"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
" T Al2O3 TiO2 Density\n",
|
||
|
"0 20 0.0 0.0 1.06250\n",
|
||
|
"1 25 0.0 0.0 1.05979\n",
|
||
|
"2 35 0.0 0.0 1.05404"
|
||
|
]
|
||
|
},
|
||
|
"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>T</th>\n",
|
||
|
" <th>Al2O3</th>\n",
|
||
|
" <th>TiO2</th>\n",
|
||
|
" <th>Density</th>\n",
|
||
|
" </tr>\n",
|
||
|
" </thead>\n",
|
||
|
" <tbody>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>0</th>\n",
|
||
|
" <td>30</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.05696</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>1</th>\n",
|
||
|
" <td>55</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.04158</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>2</th>\n",
|
||
|
" <td>25</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.08438</td>\n",
|
||
|
" </tr>\n",
|
||
|
" </tbody>\n",
|
||
|
"</table>\n",
|
||
|
"</div>"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
" T Al2O3 TiO2 Density\n",
|
||
|
"0 30 0.00 0.0 1.05696\n",
|
||
|
"1 55 0.00 0.0 1.04158\n",
|
||
|
"2 25 0.05 0.0 1.08438"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"density_train = pd.read_csv(\"data/density_train.csv\", sep=\";\", decimal=\",\")\n",
|
||
|
"density_test = pd.read_csv(\"data/density_test.csv\", sep=\";\", decimal=\",\")\n",
|
||
|
"\n",
|
||
|
"display(density_train.head(3))\n",
|
||
|
"display(density_test.head(3))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 9,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[[if (Al2O3 = 0.0) and (TiO2 = 0.0) and (T = 70) -> 1.033,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.0) and (T = 47.5) -> 1.038,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.0) and (T = 43.75) -> 1.048,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.0) and (T = 27.5) -> 1.06,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.0) and (T = 20) -> 1.062],\n",
|
||
|
" [if (Al2O3 = 0.3) and (T = 70) -> 1.144,\n",
|
||
|
" if (Al2O3 = 0.3) and (T = 50.0) -> 1.155,\n",
|
||
|
" if (Al2O3 = 0.3) and (T = 43.75) -> 1.166,\n",
|
||
|
" if (Al2O3 = 0.3) and (T = 28.75) -> 1.182,\n",
|
||
|
" if (Al2O3 = 0.3) and (T = 20) -> 1.189],\n",
|
||
|
" [if (Al2O3 = 0.0) and (TiO2 = 0.1) and (T = 70) -> 1.056,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.1) and (T = 50.0) -> 1.062,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.1) and (T = 41.25) -> 1.079,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.1) and (T = 30.0) -> 1.084,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.1) and (T = 27.5) -> 1.088,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.1) and (T = 20) -> 1.091],\n",
|
||
|
" [if (Al2O3 = 0.0) and (TiO2 = 0.3) and (T = 70) -> 1.178,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.3) and (T = 50.0) -> 1.193,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.3) and (T = 35.0) -> 1.208,\n",
|
||
|
" if (Al2O3 = 0.0) and (TiO2 = 0.3) and (T = 20) -> 1.219],\n",
|
||
|
" [if (Al2O3 = 0.1) and (TiO2 = 0.0) and (T = 70) -> 1.053,\n",
|
||
|
" if (Al2O3 = 0.1) and (TiO2 = 0.0) and (T = 50.0) -> 1.057,\n",
|
||
|
" if (Al2O3 = 0.1) and (TiO2 = 0.0) and (T = 46.25) -> 1.067,\n",
|
||
|
" if (Al2O3 = 0.1) and (TiO2 = 0.0) and (T = 20) -> 1.088]]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 9,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from src.rules import simplify_and_group_rules\n",
|
||
|
"\n",
|
||
|
"clustered_rules = simplify_and_group_rules(density_train, rules, clusters_num, kmeans.labels_)\n",
|
||
|
"clustered_rules"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 10,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"c:\\Users\\user\\Projects\\python\\fuzzy\\.venv\\Lib\\site-packages\\skfuzzy\\control\\fuzzyvariable.py:125: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown\n",
|
||
|
" fig.show()\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAGyCAYAAAAMKHu5AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACJKUlEQVR4nOzdd1RU19rH8e/QQQFBFCwo9g72hi2xd03UFBNj6tXYS4IFsYFdY4xGo+k31RKx9y5iV+y9YENsgILUmfeP817uNZYADuwpz2etWSs5nDnnB4eDz+x99t46g8FgQAghhBDCitioDiCEEEIIkdekABJCCCGE1ZECSAghhBBWRwogIYQQQlgdKYCEEEIIYXWkABJCCCGE1ZECSAghhBBWRwogIYQQQlgdKYCEEEIIYXWsrgAyGAwkJCQgE2ALIYQQ1ktpAbRz5046duxI0aJF0el0hIeH/+N7tm/fTs2aNXF0dKRs2bL8+OOP2Trnw4cPcXd35+HDhzkLLYQQQgizp7QASkxMJCAggHnz5mVp/8uXL9O+f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cytsFYCjgVUB3nmaQAekk2NjqmdfMn/nEaoatPqY4jhHmIi4b1I6F6T6jQVnWa57Oxgc7z4HEcbDDNT7FCmJqbj24y9cBUOpfpTDPfZqrjPJcUQEbg6+lCcPtKLD54na1nbquOI4Rp0+u1FhUnd2gzWXWaf+ZRElqHwZF/w7kNqtMIYdL0Bj0he0JwdXAlqG6Q6jgvJAWQkbxRx5dmFQoRtOw4cUmylpAQz3XwO7i8Azp/pRVB5qBmLyjbElYOhCSZ+kKI51l8djH7bu1jfMPxuDq4qo7zQlIAGYlOp2Pq6/6kpGUwduVJ1XGEME33LsK
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAGyCAYAAAAYveVYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACGwklEQVR4nOzdd1gU59rH8e/SQQVBFCwo9g52VKyxxm5iOcZE06MxxhorggW7JibRaDTJMd2oiVhjLLEilliwYUexgRVQkLr7/jHv4RxjCWXh2XJ/zrXXicvszG9HZr13npnn1hkMBgNCCCGEEBbCRnUAIYQQQghjkuJGCCGEEBZFihshhBBCWBQpboQQQghhUaS4EUIIIYRFkeJGCCGEEBZFihshhBBCWBQpboQQQghhUaS4EUIIIYRFsbrixmAwkJiYiEzMLIQQQlgmpcXN7t276dq1K6VKlUKn0xEWFvaPr9m5cyf16tXD0dGRSpUqsXz58hxt88GDB7i5ufHgwYPchRZCCCGESVNa3CQlJeHv78+iRYuytXx0dDSdO3emdevWHDt2jOHDh/P222/zxx9/5HNSIYQQQpgLnak0ztTpdKxZs4YePXo8c5mxY8eyceNGTp48mfXcv/71L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UMShiLIcUtwYiU6nY9ZLfqSmZxKy7pTqOEKYprsXYWswNHgTKr6gOk326XTQ7TPISIFNH6lOI4RJupp4lY8Pf0yfKn1oWqqp0ixS3BiRt5sTU7rXZO2xG/x+4qbqOEKYFn0mrB0ChYpDu2mq0+Scayl4cS6cXA2n16pOI4RJydRnEhQehIeTB6MajFIdR4obY+tRpzT
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAGyCAYAAAAYveVYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAACGqklEQVR4nOzdd1gU59rH8e/SQQFBFCwo9g52VKyxxm5iOcZETdcYY40VwYJdE2s0MckxPZZErDGWWBFLLNiwo9jACqhI3/ePeQ/nGBtl4dlyf86114nL7MxvR2a9d56Z59bp9Xo9QgghhBBmwkp1ACGEEEIIQ5LiRgghhBBmRYobIYQQQpgVKW6EEEIIYVakuBFCCCGEWZHiRgghhBBmRYobIYQQQpgVKW6EEEIIYVakuBFCCCGEWbG44kav15OQkIBMzCyEEEKYJ6XFze7du+nUqRPFixdHp9MRGhr60tfs3LmT2rVrY29vT/ny5Vm+fHm2tvngwQNcXV158OBBzkILIYQQwqgpLW4ePXqEn58fixcvztLyUVFRdOjQgRYtWnDs2DGGDh3Ke++9x59//pnHSYUQQghhKnTG0jhTp9OxZs0aunbt+txlRo8ezcaNGzl58mTmc//617+Ii4tj8+bNWdpOQkICrq6uxMfH4+LiktvYQgghhMgHer0enU6XpWVN6pqb8PBwWrVq9cRzbdu2JTw8/LmvSU5OJiEh4YkHwIOk1DzNKoQQQgjDWXtxbZaXNaniJiYmBk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ixQ3BuTl6sCkLtVYe+wGf5y4qTqOEMYlIx3WDoICRaD1FNVpss+lOLw6G06uhtNrVacRwqikZ6QTGBaIu4M7I+qOUB1HihtD61qzBG2qejI
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjcAAAGyCAYAAAAYveVYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAADDlklEQVR4nOzdeVhb95X4/7c2xCax72Yz4AVsvNvxjleEjbP42y1Jm6ZL8munmSZNO0k6aZNuSdqZdtLOdEvSdNJ2ki7TsZ3EMQJv2LHjeME73gAjsDEgdolNCEm/PxRosMFmkXQl8Xk9D8/TiKt7j32LOfqc+zlH5nA4HAiCIAiCIPgJudQBCIIgCIIguJJIbgRBEARB8CsiuREEQRAEwa+I5EYQBEEQBL8ikhtBEARBEPyKSG4EQRAEQfArIrkRBEEQBMGviORGEARBEAS/IpIbQRAEQRD8yqRLbhwOByaTCdGYWRAEQRD8k6TJzcGDB9myZQuJiYnIZDJ27Nhxx/eUlpYyf/581Go1mZmZvPHGG2O6ptlsJiwsDLPZPL6gBUEQBEHwapImN11dXcyZM4df/epXozq+urqazZs3s2bNGk6fPs0TTzzBl7/8ZYqLi90cqSAIgiAIvkLmLYMzZTIZ27dv59577x3xmKeffpr33nuP8+fPD772mc98hvb2dvR6/aiuYzKZCAsLo6OjA61WO9GwBUEQBEHwALvNjlwxujUZn3rm5siRI6xfv37Ia/n5+Rw5cmTE91gsFkwm05AvAJvdK3I6wd2q9sMf7wG7TepIBA843nCcr+z5CjZxvyeFzvcPUfvFL+Kwifs9GVQcbxz1sT6V3DQ0N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/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",
|
||
|
"temp = ctrl.Antecedent(density_train[\"T\"].sort_values().unique(), \"temp\")\n",
|
||
|
"al = ctrl.Antecedent(np.arange(0, 0.3, 0.005), \"al\")\n",
|
||
|
"ti = ctrl.Antecedent(np.arange(0, 0.3, 0.005), \"ti\")\n",
|
||
|
"density = ctrl.Consequent(np.arange(1.03, 1.22, 0.00001), \"density\")\n",
|
||
|
"\n",
|
||
|
"temp.automf(3, variable_type=\"quant\")\n",
|
||
|
"temp.view()\n",
|
||
|
"al.automf(3, variable_type=\"quant\")\n",
|
||
|
"al.view()\n",
|
||
|
"ti.automf(3, variable_type=\"quant\")\n",
|
||
|
"ti.view()\n",
|
||
|
"density.automf(5, variable_type=\"quant\")\n",
|
||
|
"density.view()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 11,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"15"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"[IF (al[low] AND ti[low]) AND temp[high] THEN density[lower]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF (al[low] AND ti[low]) AND temp[average] THEN density[lower]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF (al[low] AND ti[low]) AND temp[low] THEN density[low]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF al[high] AND temp[high] THEN density[average]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF al[high] AND temp[average] THEN density[high]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF al[high] AND temp[low] THEN density[high]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF (al[low] AND ti[average]) AND temp[high] THEN density[low]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF (al[low] AND ti[average]) AND temp[average] THEN density[low]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF (al[low] AND ti[average]) AND temp[low] THEN density[low]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF (al[low] AND ti[high]) AND temp[high] THEN density[high]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF (al[low] AND ti[high]) AND temp[average] THEN density[higher]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF (al[low] AND ti[high]) AND temp[low] THEN density[higher]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF (al[average] AND ti[low]) AND temp[high] THEN density[lower]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF (al[average] AND ti[low]) AND temp[average] THEN density[low]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax,\n",
|
||
|
" IF (al[average] AND ti[low]) AND temp[low] THEN density[low]\n",
|
||
|
" \tAND aggregation function : fmin\n",
|
||
|
" \tOR aggregation function : fmax]"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 11,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from src.rules import get_fuzzy_rules\n",
|
||
|
"\n",
|
||
|
"fuzzy_variables = {\"Al2O3\": al, \"TiO2\": ti, \"T\": temp, \"consequent\": density}\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": 12,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"=============\n",
|
||
|
" Antecedents \n",
|
||
|
"=============\n",
|
||
|
"Antecedent: al = 0.0\n",
|
||
|
" - low : 1.0\n",
|
||
|
" - average : 0.0\n",
|
||
|
" - high : 0.0\n",
|
||
|
"Antecedent: ti = 0.0\n",
|
||
|
" - low : 1.0\n",
|
||
|
" - average : 0.0\n",
|
||
|
" - high : 0.0\n",
|
||
|
"Antecedent: temp = 20\n",
|
||
|
" - low : 1.0\n",
|
||
|
" - average : 0.0\n",
|
||
|
" - high : 0.0\n",
|
||
|
"\n",
|
||
|
"=======\n",
|
||
|
" Rules \n",
|
||
|
"=======\n",
|
||
|
"RULE #0:\n",
|
||
|
" IF (al[low] AND ti[low]) AND temp[high] THEN density[lower]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[low] : 1.0\n",
|
||
|
" - ti[low] : 1.0\n",
|
||
|
" - temp[high] : 0.0\n",
|
||
|
" (al[low] AND ti[low]) AND temp[high] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[lower] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #1:\n",
|
||
|
" IF (al[low] AND ti[low]) AND temp[average] THEN density[lower]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[low] : 1.0\n",
|
||
|
" - ti[low] : 1.0\n",
|
||
|
" - temp[average] : 0.0\n",
|
||
|
" (al[low] AND ti[low]) AND temp[average] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[lower] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #2:\n",
|
||
|
" IF (al[low] AND ti[low]) AND temp[low] THEN density[low]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[low] : 1.0\n",
|
||
|
" - ti[low] : 1.0\n",
|
||
|
" - temp[low] : 1.0\n",
|
||
|
" (al[low] AND ti[low]) AND temp[low] = 1.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[low] : 1.0\n",
|
||
|
"\n",
|
||
|
"RULE #3:\n",
|
||
|
" IF al[high] AND temp[high] THEN density[average]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[high] : 0.0\n",
|
||
|
" - temp[high] : 0.0\n",
|
||
|
" al[high] AND temp[high] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[average] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #4:\n",
|
||
|
" IF al[high] AND temp[average] THEN density[high]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[high] : 0.0\n",
|
||
|
" - temp[average] : 0.0\n",
|
||
|
" al[high] AND temp[average] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[high] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #5:\n",
|
||
|
" IF al[high] AND temp[low] THEN density[high]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[high] : 0.0\n",
|
||
|
" - temp[low] : 1.0\n",
|
||
|
" al[high] AND temp[low] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[high] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #6:\n",
|
||
|
" IF (al[low] AND ti[average]) AND temp[high] THEN density[low]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[low] : 1.0\n",
|
||
|
" - ti[average] : 0.0\n",
|
||
|
" - temp[high] : 0.0\n",
|
||
|
" (al[low] AND ti[average]) AND temp[high] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[low] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #7:\n",
|
||
|
" IF (al[low] AND ti[average]) AND temp[average] THEN density[low]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[low] : 1.0\n",
|
||
|
" - ti[average] : 0.0\n",
|
||
|
" - temp[average] : 0.0\n",
|
||
|
" (al[low] AND ti[average]) AND temp[average] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[low] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #8:\n",
|
||
|
" IF (al[low] AND ti[average]) AND temp[low] THEN density[low]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[low] : 1.0\n",
|
||
|
" - ti[average] : 0.0\n",
|
||
|
" - temp[low] : 1.0\n",
|
||
|
" (al[low] AND ti[average]) AND temp[low] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[low] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #9:\n",
|
||
|
" IF (al[low] AND ti[high]) AND temp[high] THEN density[high]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[low] : 1.0\n",
|
||
|
" - ti[high] : 0.0\n",
|
||
|
" - temp[high] : 0.0\n",
|
||
|
" (al[low] AND ti[high]) AND temp[high] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[high] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #10:\n",
|
||
|
" IF (al[low] AND ti[high]) AND temp[average] THEN density[higher]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[low] : 1.0\n",
|
||
|
" - ti[high] : 0.0\n",
|
||
|
" - temp[average] : 0.0\n",
|
||
|
" (al[low] AND ti[high]) AND temp[average] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[higher] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #11:\n",
|
||
|
" IF (al[low] AND ti[high]) AND temp[low] THEN density[higher]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[low] : 1.0\n",
|
||
|
" - ti[high] : 0.0\n",
|
||
|
" - temp[low] : 1.0\n",
|
||
|
" (al[low] AND ti[high]) AND temp[low] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[higher] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #12:\n",
|
||
|
" IF (al[average] AND ti[low]) AND temp[high] THEN density[lower]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[average] : 0.0\n",
|
||
|
" - ti[low] : 1.0\n",
|
||
|
" - temp[high] : 0.0\n",
|
||
|
" (al[average] AND ti[low]) AND temp[high] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[lower] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #13:\n",
|
||
|
" IF (al[average] AND ti[low]) AND temp[average] THEN density[low]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[average] : 0.0\n",
|
||
|
" - ti[low] : 1.0\n",
|
||
|
" - temp[average] : 0.0\n",
|
||
|
" (al[average] AND ti[low]) AND temp[average] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[low] : 0.0\n",
|
||
|
"\n",
|
||
|
"RULE #14:\n",
|
||
|
" IF (al[average] AND ti[low]) AND temp[low] THEN density[low]\n",
|
||
|
"\tAND aggregation function : fmin\n",
|
||
|
"\tOR aggregation function : fmax\n",
|
||
|
"\n",
|
||
|
" Aggregation (IF-clause):\n",
|
||
|
" - al[average] : 0.0\n",
|
||
|
" - ti[low] : 1.0\n",
|
||
|
" - temp[low] : 1.0\n",
|
||
|
" (al[average] AND ti[low]) AND temp[low] = 0.0\n",
|
||
|
" Activation (THEN-clause):\n",
|
||
|
" density[low] : 0.0\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"==============================\n",
|
||
|
" Intermediaries and Conquests \n",
|
||
|
"==============================\n",
|
||
|
"Consequent: density = 1.0774975002635008\n",
|
||
|
" lower:\n",
|
||
|
" Accumulate using accumulation_max : 0.0\n",
|
||
|
" low:\n",
|
||
|
" Accumulate using accumulation_max : 1.0\n",
|
||
|
" average:\n",
|
||
|
" Accumulate using accumulation_max : 0.0\n",
|
||
|
" high:\n",
|
||
|
" Accumulate using accumulation_max : 0.0\n",
|
||
|
" higher:\n",
|
||
|
" Accumulate using accumulation_max : 0.0\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"np.float64(1.0774975002635008)"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"sim.input[\"temp\"] = 20\n",
|
||
|
"sim.input[\"al\"] = 0.0\n",
|
||
|
"sim.input[\"ti\"] = 0.0\n",
|
||
|
"sim.compute()\n",
|
||
|
"sim.print_state()\n",
|
||
|
"display(sim.output[\"density\"])"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 13,
|
||
|
"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>T</th>\n",
|
||
|
" <th>Al2O3</th>\n",
|
||
|
" <th>TiO2</th>\n",
|
||
|
" <th>Density</th>\n",
|
||
|
" <th>DensityPred</th>\n",
|
||
|
" </tr>\n",
|
||
|
" </thead>\n",
|
||
|
" <tbody>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>0</th>\n",
|
||
|
" <td>20</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.06250</td>\n",
|
||
|
" <td>1.077498</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>1</th>\n",
|
||
|
" <td>25</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.05979</td>\n",
|
||
|
" <td>1.076593</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>2</th>\n",
|
||
|
" <td>35</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.05404</td>\n",
|
||
|
" <td>1.069156</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>3</th>\n",
|
||
|
" <td>40</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.05103</td>\n",
|
||
|
" <td>1.061106</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>4</th>\n",
|
||
|
" <td>45</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.04794</td>\n",
|
||
|
" <td>1.045833</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>5</th>\n",
|
||
|
" <td>50</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.04477</td>\n",
|
||
|
" <td>1.046360</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>6</th>\n",
|
||
|
" <td>60</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.03826</td>\n",
|
||
|
" <td>1.047642</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>7</th>\n",
|
||
|
" <td>65</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.03484</td>\n",
|
||
|
" <td>1.046360</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>8</th>\n",
|
||
|
" <td>70</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.03182</td>\n",
|
||
|
" <td>1.045833</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>9</th>\n",
|
||
|
" <td>20</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.08755</td>\n",
|
||
|
" <td>1.077498</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>10</th>\n",
|
||
|
" <td>45</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.07105</td>\n",
|
||
|
" <td>1.067145</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>11</th>\n",
|
||
|
" <td>50</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.06760</td>\n",
|
||
|
" <td>1.067145</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>12</th>\n",
|
||
|
" <td>55</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.06409</td>\n",
|
||
|
" <td>1.067988</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>13</th>\n",
|
||
|
" <td>65</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.05691</td>\n",
|
||
|
" <td>1.062538</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>14</th>\n",
|
||
|
" <td>70</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.0</td>\n",
|
||
|
" <td>1.05291</td>\n",
|
||
|
" <td>1.047191</td>\n",
|
||
|
" </tr>\n",
|
||
|
" </tbody>\n",
|
||
|
"</table>\n",
|
||
|
"</div>"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
" T Al2O3 TiO2 Density DensityPred\n",
|
||
|
"0 20 0.00 0.0 1.06250 1.077498\n",
|
||
|
"1 25 0.00 0.0 1.05979 1.076593\n",
|
||
|
"2 35 0.00 0.0 1.05404 1.069156\n",
|
||
|
"3 40 0.00 0.0 1.05103 1.061106\n",
|
||
|
"4 45 0.00 0.0 1.04794 1.045833\n",
|
||
|
"5 50 0.00 0.0 1.04477 1.046360\n",
|
||
|
"6 60 0.00 0.0 1.03826 1.047642\n",
|
||
|
"7 65 0.00 0.0 1.03484 1.046360\n",
|
||
|
"8 70 0.00 0.0 1.03182 1.045833\n",
|
||
|
"9 20 0.05 0.0 1.08755 1.077498\n",
|
||
|
"10 45 0.05 0.0 1.07105 1.067145\n",
|
||
|
"11 50 0.05 0.0 1.06760 1.067145\n",
|
||
|
"12 55 0.05 0.0 1.06409 1.067988\n",
|
||
|
"13 65 0.05 0.0 1.05691 1.062538\n",
|
||
|
"14 70 0.05 0.0 1.05291 1.047191"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 13,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"def fuzzy_pred(row):\n",
|
||
|
" sim.input[\"temp\"] = row[\"T\"]\n",
|
||
|
" sim.input[\"al\"] = row[\"Al2O3\"]\n",
|
||
|
" sim.input[\"ti\"] = row[\"TiO2\"]\n",
|
||
|
" sim.compute()\n",
|
||
|
" return sim.output[\"density\"]\n",
|
||
|
"\n",
|
||
|
"result_train = density_train.copy()\n",
|
||
|
"result_train[\"DensityPred\"] = result_train.apply(fuzzy_pred, axis=1)\n",
|
||
|
"result_train.head(15)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 14,
|
||
|
"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>T</th>\n",
|
||
|
" <th>Al2O3</th>\n",
|
||
|
" <th>TiO2</th>\n",
|
||
|
" <th>Density</th>\n",
|
||
|
" <th>DensityPred</th>\n",
|
||
|
" </tr>\n",
|
||
|
" </thead>\n",
|
||
|
" <tbody>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>0</th>\n",
|
||
|
" <td>30</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>1.05696</td>\n",
|
||
|
" <td>1.073918</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>1</th>\n",
|
||
|
" <td>55</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>1.04158</td>\n",
|
||
|
" <td>1.047642</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>2</th>\n",
|
||
|
" <td>25</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>1.08438</td>\n",
|
||
|
" <td>1.076518</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>3</th>\n",
|
||
|
" <td>30</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>1.08112</td>\n",
|
||
|
" <td>1.073918</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>4</th>\n",
|
||
|
" <td>35</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>1.07781</td>\n",
|
||
|
" <td>1.069156</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>5</th>\n",
|
||
|
" <td>40</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>1.07446</td>\n",
|
||
|
" <td>1.067145</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>6</th>\n",
|
||
|
" <td>60</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>1.06053</td>\n",
|
||
|
" <td>1.067988</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>7</th>\n",
|
||
|
" <td>35</td>\n",
|
||
|
" <td>0.30</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>1.17459</td>\n",
|
||
|
" <td>1.172492</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>8</th>\n",
|
||
|
" <td>65</td>\n",
|
||
|
" <td>0.30</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>1.14812</td>\n",
|
||
|
" <td>1.136460</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>9</th>\n",
|
||
|
" <td>45</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>1.07424</td>\n",
|
||
|
" <td>1.067145</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>10</th>\n",
|
||
|
" <td>50</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>1.07075</td>\n",
|
||
|
" <td>1.067145</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>11</th>\n",
|
||
|
" <td>55</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.05</td>\n",
|
||
|
" <td>1.06721</td>\n",
|
||
|
" <td>1.067988</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>12</th>\n",
|
||
|
" <td>20</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.30</td>\n",
|
||
|
" <td>1.22417</td>\n",
|
||
|
" <td>1.204157</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>13</th>\n",
|
||
|
" <td>30</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.30</td>\n",
|
||
|
" <td>1.21310</td>\n",
|
||
|
" <td>1.202348</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>14</th>\n",
|
||
|
" <td>40</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.30</td>\n",
|
||
|
" <td>1.20265</td>\n",
|
||
|
" <td>1.203630</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>15</th>\n",
|
||
|
" <td>60</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.30</td>\n",
|
||
|
" <td>1.18265</td>\n",
|
||
|
" <td>1.176072</td>\n",
|
||
|
" </tr>\n",
|
||
|
" <tr>\n",
|
||
|
" <th>16</th>\n",
|
||
|
" <td>70</td>\n",
|
||
|
" <td>0.00</td>\n",
|
||
|
" <td>0.30</td>\n",
|
||
|
" <td>1.17261</td>\n",
|
||
|
" <td>1.172492</td>\n",
|
||
|
" </tr>\n",
|
||
|
" </tbody>\n",
|
||
|
"</table>\n",
|
||
|
"</div>"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
" T Al2O3 TiO2 Density DensityPred\n",
|
||
|
"0 30 0.00 0.00 1.05696 1.073918\n",
|
||
|
"1 55 0.00 0.00 1.04158 1.047642\n",
|
||
|
"2 25 0.05 0.00 1.08438 1.076518\n",
|
||
|
"3 30 0.05 0.00 1.08112 1.073918\n",
|
||
|
"4 35 0.05 0.00 1.07781 1.069156\n",
|
||
|
"5 40 0.05 0.00 1.07446 1.067145\n",
|
||
|
"6 60 0.05 0.00 1.06053 1.067988\n",
|
||
|
"7 35 0.30 0.00 1.17459 1.172492\n",
|
||
|
"8 65 0.30 0.00 1.14812 1.136460\n",
|
||
|
"9 45 0.00 0.05 1.07424 1.067145\n",
|
||
|
"10 50 0.00 0.05 1.07075 1.067145\n",
|
||
|
"11 55 0.00 0.05 1.06721 1.067988\n",
|
||
|
"12 20 0.00 0.30 1.22417 1.204157\n",
|
||
|
"13 30 0.00 0.30 1.21310 1.202348\n",
|
||
|
"14 40 0.00 0.30 1.20265 1.203630\n",
|
||
|
"15 60 0.00 0.30 1.18265 1.176072\n",
|
||
|
"16 70 0.00 0.30 1.17261 1.172492"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 14,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"result_test = density_test.copy()\n",
|
||
|
"result_test[\"DensityPred\"] = result_test.apply(fuzzy_pred, axis=1)\n",
|
||
|
"result_test"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 15,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"{'RMSE_train': 0.009765373953597112,\n",
|
||
|
" 'RMSE_test': 0.009031443610368107,\n",
|
||
|
" 'RMAE_test': 0.08581225574298121,\n",
|
||
|
" 'R2_test': 0.978451748357252}"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 15,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import math\n",
|
||
|
"from sklearn import metrics\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"rmetrics = {}\n",
|
||
|
"rmetrics[\"RMSE_train\"] = math.sqrt(\n",
|
||
|
" metrics.mean_squared_error(result_train[\"Density\"], result_train[\"DensityPred\"])\n",
|
||
|
")\n",
|
||
|
"rmetrics[\"RMSE_test\"] = math.sqrt(\n",
|
||
|
" metrics.mean_squared_error(result_test[\"Density\"], result_test[\"DensityPred\"])\n",
|
||
|
")\n",
|
||
|
"rmetrics[\"RMAE_test\"] = math.sqrt(\n",
|
||
|
" metrics.mean_absolute_error(result_test[\"Density\"], result_test[\"DensityPred\"])\n",
|
||
|
")\n",
|
||
|
"rmetrics[\"R2_test\"] = metrics.r2_score(\n",
|
||
|
" result_test[\"Density\"], result_test[\"DensityPred\"]\n",
|
||
|
")\n",
|
||
|
"\n",
|
||
|
"rmetrics"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"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.7"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|