diff --git a/lab_7/Lab7.ipynb b/lab_7/Lab7.ipynb
index 36a7f5a..bde5b1c 100644
--- a/lab_7/Lab7.ipynb
+++ b/lab_7/Lab7.ipynb
@@ -9,7 +9,7 @@
},
{
"cell_type": "code",
- "execution_count": 35,
+ "execution_count": 70,
"metadata": {},
"outputs": [],
"source": [
@@ -20,7 +20,7 @@
},
{
"cell_type": "code",
- "execution_count": 36,
+ "execution_count": 71,
"metadata": {},
"outputs": [],
"source": [
@@ -47,7 +47,7 @@
},
{
"cell_type": "code",
- "execution_count": 37,
+ "execution_count": 72,
"metadata": {},
"outputs": [],
"source": [
@@ -83,7 +83,7 @@
},
{
"cell_type": "code",
- "execution_count": 38,
+ "execution_count": 73,
"metadata": {},
"outputs": [
{
@@ -218,7 +218,7 @@
},
{
"cell_type": "code",
- "execution_count": 45,
+ "execution_count": 74,
"metadata": {},
"outputs": [
{
@@ -272,7 +272,7 @@
}
],
"conversionMethod": "pd.DataFrame",
- "ref": "5922a94b-2599-4b50-a82a-b7ba0c907a61",
+ "ref": "6df9d4d6-0a40-404e-b085-39cbd7b0c963",
"rows": [
[
"15251",
@@ -335,7 +335,7 @@
"450",
"17.99",
"92",
- "88.79909989039582"
+ "89.20378747679185"
],
[
"14595",
@@ -447,7 +447,7 @@
"28",
"17.99",
"96",
- "89.30806692369116"
+ "89.60745365568543"
],
[
"11451",
@@ -461,7 +461,7 @@
"50",
"19.99",
"68",
- "85.46326054861929"
+ "86.68910788534616"
],
[
"16976",
@@ -566,7 +566,7 @@
"696",
"19.99",
"86",
- "84.47340305190548"
+ "86.10011067019401"
],
[
"37115",
@@ -601,7 +601,7 @@
"1084",
"19.99",
"84",
- "83.92495287088245"
+ "85.49351318658027"
],
[
"12818",
@@ -717,7 +717,7 @@
"
4598 | \n",
" 59.99 | \n",
" 92 | \n",
- " 28.455605 | \n",
+ " 49.500000 | \n",
" \n",
" \n",
" 27959 | \n",
@@ -748,14 +748,14 @@
"... ... ... ... ...\n",
"2652 55 14.99 74 90.615416\n",
"30351 41 9.99 82 85.367169\n",
- "1810 4598 59.99 92 28.455605\n",
+ "1810 4598 59.99 92 49.500000\n",
"27959 115 2.99 73 74.155404\n",
"2864 15 4.99 86 74.231120\n",
"\n",
"[10142 rows x 4 columns]"
]
},
- "execution_count": 45,
+ "execution_count": 74,
"metadata": {},
"output_type": "execute_result"
}
@@ -777,9 +777,9 @@
"rule2 = ctrl.Rule(reviews['many'] & price['medium'], pos['high']) #avg\n",
"rule3 = ctrl.Rule(reviews['many'] & price['expensive'], pos['high']) \n",
"\n",
- "rule4 = ctrl.Rule(reviews['few'] & price['cheap'], pos['high']) #avg\n",
+ "rule4 = ctrl.Rule(reviews['few'] & price['cheap'], pos['high']) \n",
"rule5 = ctrl.Rule(reviews['few'] & price['medium'], pos['higher']) #avg\n",
- "rule6 = ctrl.Rule(reviews['few'] & price['expensive'], pos['low'])\n",
+ "rule6 = ctrl.Rule(reviews['few'] & price['expensive'], pos['average']) #low\n",
"\n",
"rule7 = ctrl.Rule(reviews['avg'] & price['cheap'], pos['average'])\n",
"rule8 = ctrl.Rule(reviews['avg'] & price['medium'], pos['high'])\n",
@@ -800,13 +800,11 @@
"\n",
"fuzzy_sys = ctrl.ControlSystemSimulation(ctrl.ControlSystem(fuzzy_rules))\n",
"\n",
- "#ТУТ ПОМЕНЯТЬ НАЗВАНИЯ СТОЛБЦОВ И НЕЧЁТКИХ ПЕРЕМЕННЫХ НА СВОИ\n",
+ "\n",
"def fuzzy_pred(row):\n",
- " # al - нечёт. пер. ; al2o3 - столбец датасета\n",
" fuzzy_sys.input[\"reviews\"] = row[\"user_reviews\"]\n",
" fuzzy_sys.input[\"price\"] = row[\"price_original\"]\n",
" fuzzy_sys.compute()\n",
- " # return fuzzy_sys.output[\"positive_ratio\"]\n",
" return fuzzy_sys.output[\"pos\"]\n",
"\n",
"from sklearn.model_selection import train_test_split\n",
@@ -829,15 +827,15 @@
},
{
"cell_type": "code",
- "execution_count": 46,
+ "execution_count": 75,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "R^2 = -0.6240120497062605\n",
- "RMSE = 23.36652781503876\n"
+ "R^2 = -0.29858167190494145\n",
+ "RMSE = 20.894606342915804\n"
]
}
],
@@ -845,9 +843,9 @@
"#Оценка\n",
"import math\n",
"from sklearn import metrics\n",
- "print(f\"R^2 = {metrics.r2_score(result_test[\"positive_ratio\"], result_test[\"positive_ratio_pred\"])}\")\n",
+ "print(f\"R^2 = {metrics.r2_score(test[\"positive_ratio\"], result_test[\"positive_ratio_pred\"])}\")\n",
"print(f\"RMSE = {math.sqrt(\n",
- " metrics.mean_squared_error(result_test[\"positive_ratio\"], result_test[\"positive_ratio_pred\"])\n",
+ " metrics.mean_squared_error(test[\"positive_ratio\"], result_test[\"positive_ratio_pred\"])\n",
")}\")"
]
},
@@ -857,7 +855,7 @@
"source": [
"Оценки показали, что построенная нечёткая система плохо справляется с предсказанием соотношения положительных отзывов к негативным. \n",
"\n",
- "Средняя квадратичная ошибка составляет почти 25%, что является большой ошибкой для диапазона от 0 до 100. \n",
+ "Средняя квадратичная ошибка составляет примерно 20%, что является достаточно большой ошибкой для диапазона от 0 до 100. \n",
"\n",
"Коэффициент детерминации получился отрицательным. Это означает, что система работает хуже, чем простое предсказание средним значением. Это говорит о том, что гипотезы о зависимости положительности отзывов от цены игры и количества отзывов, проявляемые в виде базы нечётких правил, неправильно отражают действительность. \n",
"\n",