polynomial_regression/Regresja_wielomianowa.ipynb

1343 lines
419 KiB
Plaintext
Raw Normal View History

2022-06-20 20:34:11 +02:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Regresja wielomianowa"
]
},
{
2022-06-21 16:42:59 +02:00
"cell_type": "markdown",
"metadata": {},
2022-06-20 20:34:11 +02:00
"source": [
"![polynomial_regression](regression.png)\n",
"\n",
"Celem regresji wielomianowej jest zamodelowanie relacji między zmienną zależną od zmiennych niezależnych jako funkcję wielomianu n-tego stopnia.\n",
"\n",
"Postać ogólna regresji wielomianowej:\n",
"\n",
"$$ h_{\\theta}(x) = \\sum_{i=0}^{n} \\theta_i x^i $$\n",
"\n",
"Gdzie:\n",
"\n",
"$$ \\theta - \\text{wektor parametrów modelu} $$ "
2022-06-21 16:42:59 +02:00
]
2022-06-20 20:34:11 +02:00
},
{
2022-06-21 16:42:59 +02:00
"cell_type": "markdown",
"metadata": {},
2022-06-20 20:34:11 +02:00
"source": [
"## Funkcja kosztu\n",
"![MSE](mse.webp)\n",
"\n",
"W celu odpowiedniego dobrania parametrów modelu, trzeba znaleźć minimum funkcji kosztu zdefiniowanej poniższym wzorem:\n",
"\n",
"$$ J = \\frac{1}{2m} (X \\theta - y)^T (X \\theta - y) $$\n",
"\n",
"Gdzie:\n",
"\n",
"$$ m - \\text{ilość przykładów} $$ \n",
"\n",
"Za funkcję kosztu przyjmuje się zmodyfikowaną wersję błędu średniokwadratowego. Dodatkowo dodaje się dzielenie przez 2*m zamiast m, aby gradient z funkcji był lepszej postaci."
2022-06-21 16:42:59 +02:00
]
2022-06-20 20:34:11 +02:00
},
{
2022-06-21 16:42:59 +02:00
"cell_type": "markdown",
"metadata": {},
2022-06-20 20:34:11 +02:00
"source": [
"## Metoda gradientu prostego\n",
"![gradient_descent](gradient.png)"
2022-06-21 16:42:59 +02:00
]
2022-06-20 20:34:11 +02:00
},
{
2022-06-21 16:42:59 +02:00
"cell_type": "markdown",
"metadata": {},
2022-06-20 20:34:11 +02:00
"source": [
"Do znalezienia minimum funckji kosztu można użyć metody gradientu prostego. W tym celu iteracyjnie liczy się gradient funkcji kosztu i aktualizuje się za jego pomocą wektor parametrów modelu aż do uzyskania zbieżności (Różnica między obliczoną funkcją kosztu a funkcją kosztu w poprzedniej iteracji będzie mniejsza od ustalonej wcześniej wartości $\\varepsilon$).\n",
"\n",
"Gradient funkcji kosztu:\n",
"\n",
"$$ \\dfrac{\\partial J(\\theta)}{\\partial \\theta} = \\frac{1}{m}X^T(X \\theta - y)$$\n",
"\n",
"Modyfikacja parametrów modelu:\n",
"\n",
"$$ \\theta_{new} = \\theta - \\alpha * \\dfrac{\\partial J(\\theta)}{\\partial \\theta}$$\n",
"\n",
"Gdzie:\n",
"\n",
"$$ \\alpha - \\text{współczynnik uczenia} $$"
2022-06-21 16:42:59 +02:00
]
2022-06-20 20:34:11 +02:00
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 1,
2022-06-20 20:34:11 +02:00
"metadata": {
"slideshow": {
"slide_type": "notes"
}
},
"outputs": [],
"source": [
"import ipywidgets as widgets\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas\n",
"\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 2,
2022-06-20 20:34:11 +02:00
"metadata": {
"slideshow": {
"slide_type": "notes"
}
},
"outputs": [],
"source": [
"# Przydatne funkcje\n",
"cost_functions = dict()\n",
"\n",
"def cost(theta, X, y):\n",
" \"\"\"Wersja macierzowa funkcji kosztu\"\"\"\n",
" m = len(y)\n",
" J = 1.0 / (2.0 * m) * ((X * theta - y).T * (X * theta - y))\n",
" return J.item()\n",
"\n",
"def gradient(theta, X, y):\n",
" \"\"\"Wersja macierzowa gradientu funkcji kosztu\"\"\"\n",
" return 1.0 / len(y) * (X.T * (X * theta - y)) \n",
"\n",
"def gradient_descent(fJ, fdJ, theta, X, y, alpha=0.1, eps=10**-7):\n",
" \"\"\"Algorytm gradientu prostego\"\"\"\n",
" current_cost = fJ(theta, X, y)\n",
" logs = [[current_cost, theta]]\n",
" while True:\n",
" theta = theta - alpha * fdJ(theta, X, y)\n",
" current_cost, prev_cost = fJ(theta, X, y), current_cost\n",
" # print(current_cost)\n",
" if abs(prev_cost - current_cost) > 10**15:\n",
" print('Algorytm nie jest zbieżny!')\n",
" break\n",
" if abs(prev_cost - current_cost) <= eps:\n",
" break\n",
" logs.append([current_cost, theta]) \n",
" return theta, logs\n",
"\n",
"def plot_data(X, y, xlabel, ylabel):\n",
" \"\"\"Wykres danych\"\"\"\n",
" fig = plt.figure(figsize=(16*.6, 9*.6))\n",
" ax = fig.add_subplot(111)\n",
" fig.subplots_adjust(left=0.1, right=0.9, bottom=0.1, top=0.9)\n",
" ax.scatter([X[:, 1]], [y], c='r', s=50, label='Dane')\n",
" \n",
" ax.set_xlabel(xlabel)\n",
" ax.set_ylabel(ylabel)\n",
" ax.margins(.05, .05)\n",
" plt.ylim(y.min() - 1, y.max() + 1)\n",
" plt.xlim(np.min(X[:, 1]) - 1, np.max(X[:, 1]) + 1)\n",
" return fig\n",
"\n",
"def plot_data_cost(X, y, xlabel, ylabel):\n",
" \"\"\"Wykres funkcji kosztu\"\"\"\n",
" fig = plt.figure(figsize=(16 * .6, 9 * .6))\n",
" ax = fig.add_subplot(111)\n",
" fig.subplots_adjust(left=0.1, right=0.9, bottom=0.1, top=0.9)\n",
" ax.scatter([X], [y], c='r', s=50, label='Dane')\n",
"\n",
" ax.set_xlabel(xlabel)\n",
" ax.set_ylabel(ylabel)\n",
" ax.margins(.05, .05)\n",
" plt.ylim(min(y) - 1, max(y) + 1)\n",
" plt.xlim(np.min(X) - 1, np.max(X) + 1)\n",
" return fig\n",
"\n",
"def plot_fun(fig, fun, X):\n",
" \"\"\"Wykres funkcji `fun`\"\"\"\n",
" ax = fig.axes[0]\n",
" x0 = np.min(X[:, 1]) - 1.0\n",
" x1 = np.max(X[:, 1]) + 1.0\n",
" Arg = np.arange(x0, x1, 0.1)\n",
" Val = fun(Arg)\n",
" return ax.plot(Arg, Val, linewidth='2')"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 3,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [],
"source": [
"def MSE(Y_true, Y_pred):\n",
" \"\"\"Błąd średniokwadratowy - Mean Squared Error\"\"\"\n",
" return np.square(np.subtract(Y_true,Y_pred)).mean()"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 4,
2022-06-20 20:34:11 +02:00
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [],
"source": [
"# Funkcja regresji wielomianowej\n",
"\n",
"def h_poly(Theta, x):\n",
" \"\"\"Funkcja wielomianowa\"\"\"\n",
" return sum(theta * np.power(x, i) for i, theta in enumerate(Theta.tolist()))\n",
"\n",
"def get_poly_data(data, deg):\n",
" \"\"\"Przygotowanie danych do regresji wielomianowej\"\"\"\n",
" m, n_plus_1 = data.shape\n",
" n = n_plus_1 - 1\n",
"\n",
" X1 = data[:, 0:n]\n",
" X1 /= np.amax(X1, axis=0)\n",
"\n",
" Xs = [np.ones((m, 1)), X1]\n",
"\n",
" for i in range(2, deg+1):\n",
" Xn = np.power(X1, i)\n",
" Xn /= np.amax(Xn, axis=0)\n",
" Xs.append(Xn)\n",
"\n",
" X = np.matrix(np.concatenate(Xs, axis=1)).reshape(m, deg * n + 1)\n",
"\n",
" y = np.matrix(data[:, -1]).reshape(m, 1)\n",
"\n",
" return X, y\n",
"\n",
"\n",
"def polynomial_regression(X, y, n):\n",
" \"\"\"Funkcja regresji wielomianowej\"\"\"\n",
" theta_start = np.matrix([0] * (n+1)).reshape(n+1, 1)\n",
" theta, logs = gradient_descent(cost, gradient, theta_start, X, y)\n",
" return lambda x: h_poly(theta, x), logs"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 5,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [],
"source": [
"def predict_values(model, data, n):\n",
" \"\"\"Funkcja predykcji\"\"\"\n",
" x, y = get_poly_data(np.array(data), n)\n",
" preprocessed_x = []\n",
" for i in x:\n",
" preprocessed_x.append(i.item(1))\n",
" return y, model(preprocessed_x), MSE(y, model(preprocessed_x))\n",
"\n",
"def plot_and_mse(data, data_test, n):\n",
" \"\"\"Wykres wraz z MSE\"\"\"\n",
" x, y = get_poly_data(np.array(data), n)\n",
" model, logs = polynomial_regression(x, y, n)\n",
" cost_function = [[element[0], i] for i, element in enumerate(logs)]\n",
" cost_functions[n] = cost_function\n",
" \n",
" fig = plot_data(x, y, xlabel='x', ylabel='y')\n",
" plot_fun(fig, model, x)\n",
"\n",
" y_true, Y_pred, mse = predict_values(model, data_test, n)\n",
" print(f'Wielomian {n} stopnia, MSE = {mse}')"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 6,
2022-06-20 20:34:11 +02:00
"metadata": {
"slideshow": {
"slide_type": "notes"
}
},
"outputs": [
{
"data": {
2022-06-21 16:42:59 +02:00
"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>sqrMetres</th>\n",
" <th>price</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>318</th>\n",
" <td>62</td>\n",
" <td>399000.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1294</th>\n",
" <td>50</td>\n",
" <td>247705.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>593</th>\n",
" <td>15</td>\n",
" <td>349668.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1486</th>\n",
" <td>20</td>\n",
" <td>347633.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>224</th>\n",
" <td>42</td>\n",
" <td>289000.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1410</th>\n",
" <td>50</td>\n",
" <td>315000.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>424</th>\n",
" <td>14</td>\n",
" <td>330255.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>103</th>\n",
" <td>21</td>\n",
" <td>327584.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>983</th>\n",
" <td>78</td>\n",
" <td>496573.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>418</th>\n",
" <td>16</td>\n",
" <td>309978.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>1674 rows × 2 columns</p>\n",
"</div>"
],
2022-06-20 20:34:11 +02:00
"text/plain": [
" sqrMetres price\n",
2022-06-21 16:42:59 +02:00
"318 62 399000.0\n",
"1294 50 247705.0\n",
"593 15 349668.0\n",
"1486 20 347633.0\n",
"224 42 289000.0\n",
2022-06-20 20:34:11 +02:00
"... ... ...\n",
2022-06-21 16:42:59 +02:00
"1410 50 315000.0\n",
"424 14 330255.0\n",
"103 21 327584.0\n",
"983 78 496573.0\n",
"418 16 309978.0\n",
2022-06-20 20:34:11 +02:00
"\n",
"[1674 rows x 2 columns]"
2022-06-21 16:42:59 +02:00
]
2022-06-20 20:34:11 +02:00
},
2022-06-21 16:42:59 +02:00
"execution_count": 6,
2022-06-20 20:34:11 +02:00
"metadata": {},
2022-06-21 16:42:59 +02:00
"output_type": "execute_result"
2022-06-20 20:34:11 +02:00
}
],
"source": [
"# Wczytanie danych (mieszkania) przy pomocy biblioteki pandas\n",
"\n",
"alldata = pandas.read_csv('data_flats.tsv', header=0, sep='\\t',\n",
" usecols=['price', 'rooms', 'sqrMetres'])\n",
"alldata = alldata[['sqrMetres', 'price']]\n",
"alldata = alldata.sample(frac=1)\n",
"alldata"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 7,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [],
"source": [
"# alldata = np.matrix(alldata[['sqrMetres', 'price']])\n",
"data_train = alldata[0:1600]\n",
"data_test = alldata[1600:]\n",
"data_train = np.matrix(data_train).astype(float)\n",
"data_test = np.matrix(data_test).astype(float)"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 8,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [
{
"name": "stdout",
2022-06-21 16:42:59 +02:00
"output_type": "stream",
2022-06-20 20:34:11 +02:00
"text": [
2022-06-21 16:42:59 +02:00
"Wielomian 1 stopnia, MSE = 35514312788.779144\n",
"Wielomian 2 stopnia, MSE = 90239672317.31158\n",
"Wielomian 3 stopnia, MSE = 89217346258.50258\n"
2022-06-20 20:34:11 +02:00
]
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmQAAAFvCAYAAADkPtfiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABBpklEQVR4nO3deXTc9X3v/9dntNqSvC+yNTIGLGxsC4ylsBSHsJhNECBYqnPbk5Ic0rQJyS2h7cnyy2nuubcNNL03bdpA01wnJfQ2xJXsAAkGgtkdwiI5NrKNjYwJ1kjeVy2Wtczn98dHIwl5RjMjzcx3Rno+zvGR/J3trZGMXnyW98dYawUAAADv+LwuAAAAYKIjkAEAAHiMQAYAAOAxAhkAAIDHCGQAAAAeI5ABAAB4LCMDmTHmJ8aYw8aYHTHe/w+NMbuMMTuNMT9Ldn0AAADxMJnYh8wYc42kdkmPWWuXR7lvmaT/knS9tfaEMWaOtfZwK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fsistaette39n2+SlGOMmeVVPQAAAF7xLJAZY4qNMab/88v7aznmVT0AAABeSdouS2PM45KulTTLGBOQ9G1JOZJkrf2hpGpJXzTG9Eo6I+nT1lqbrHoAAADSVdICmbX2v0W5/QdybTEAAAAmNK93WQIAAEx4BDIAAACPEcgAAAA8RiADAADwGIEMAADAY1EDmTHmK8aY6akoBgAAYCKKpe3FXElvG2O2SvqJpOfoFwZgzNrapPXrpaYmqaxMWrtWKiryuioA8ISJJVv1d9S/SdLnJFVK+i9JP7bWvp/c8s5VWVlp6+v
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmQAAAFvCAYAAADkPtfiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABXJ0lEQVR4nO3dd3hUZfo38O8zk0zKJCGEJEAKhEBo0nsTwS52RYMVVuysyuq6oOvuvr9tKK66qGDDAipFseGCInaRDtJbQigJCRBaMullnvePZ4aEMDWZmTPl+7muXBPOOTlzMwnMnafct5BSgoiIiIi0o9M6ACIiIqJQx4SMiIiISGNMyIiIiIg0xoSMiIiISGNMyIiIiIg0xoSMiIiISGMBmZAJId4RQhwXQuxw8fpbhRC7hBA7hRALvB0fERERkTtEINYhE0KMBlAGYL6UspeTa7MAfATgYinlaSFEspTyuC/iJCIiInJFQI6QSSl/BnCq8TEhRGchxNdCiE1CiF+EEN0tp+4DMFtKedrytUzGiIiIyK8EZEJmx5sAHpFSDgTwRwBzLMe7AugqhPhVCLFWCHGlZhESERER2RCmdQCeIISIATACwMdCCOvhCMtjGIAsAGMApAH4WQj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KYaquQ/8O8ejeLk7rcIjOw4QMgE4ncOdQawmMg9oGQ0REHreIi/nJzzEhs7hlUBoiwnT4JecE+1sSEQWRvUdN2HToNGIjwnBNHy7mJ//EhMwiPtqA6/up/pYfsL8lEVHQsPatvL5/CqINYRpHQ2QbE7JGrP0tP2Z/SyKioFBVW4/Pzlbm53Ql+S8mZI30Sm2Ffpb+ll9
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmQAAAFvCAYAAADkPtfiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABVJUlEQVR4nO3dd3jUVdYH8O+dyaRNAgGSEEgCoYSOoPSqIipgW2sQG4oiirrouotuf9fdFfviCipiQVcRu6goiJVIB+ktIZRUSICESU9m7vvHzZAQpiYz85vy/TwPz8DMLzOHSUgO5957jpBSgoiIiIi0o9M6ACIiIqJQx4SMiIiISGNMyIiIiIg0xoSMiIiISGNMyIiIiIg0xoSMiIiISGMBmZAJId4QQhwXQuxy8fqbhBB7hBC7hRDveTs+IiIiIneIQOxDJoQYD6AcwNtSygFOrk0H8AGACVLKU0KIRCnlcV/ESUREROSKgKyQSSl/BnCy6X1CiB5CiG+EEFuEEGuEEH0aHroHwAIp5amGj2UyRkRERH4lIBMyOxYBeFBKOQTAowAWNtzfC0AvIcQvQoj1QohJmkVIREREZEOY1gF4ghAiBsBoAB8KIax3RzTchgFIB3ARgBQAPwshBkopS30cJhEREZFNQZGQQVX6SqWUg208lgdgg5SyDsAhIcQBqARtkw/jIyIiIrIrKJYspZSnoZKtGwFAKIMaHv4Mq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odDREQNTlbU4v1Naoj4zPHdNY6GQh0TMi9rG2XAhb0TIKUaOE5ERP7h7XWHUV1nwUW9E9C
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
}
],
"source": [
"cost_fun_slices = []\n",
"for n in range(1, 4):\n",
" plot_and_mse(data_train, data_test, n)\n",
" \n",
" cost_data = cost_functions.get(n)\n",
" cost_x = [line[1] for line in cost_data[:250]]\n",
" cost_y = [line[0] for line in cost_data[:250]]\n",
" cost_fun_slices.append((cost_x, cost_y))"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 18,
"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>araba_fiyat</th>\n",
" <th>araba_max_hiz</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>250</td>\n",
" <td>240</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>1000</td>\n",
" <td>365</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>2000</td>\n",
" <td>365</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>100</td>\n",
" <td>200</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>750</td>\n",
" <td>360</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>80</td>\n",
" <td>200</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>300</td>\n",
" <td>300</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>60</td>\n",
" <td>180</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>400</td>\n",
" <td>350</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>120</td>\n",
" <td>200</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>70</td>\n",
" <td>180</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>500</td>\n",
" <td>350</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>200</td>\n",
" <td>240</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>150</td>\n",
" <td>220</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>3000</td>\n",
" <td>365</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" araba_fiyat araba_max_hiz\n",
"7 250 240\n",
"12 1000 365\n",
"13 2000 365\n",
"3 100 200\n",
"11 750 360\n",
"2 80 200\n",
"8 300 300\n",
"0 60 180\n",
"9 400 350\n",
"4 120 200\n",
"1 70 180\n",
"10 500 350\n",
"6 200 240\n",
"5 150 220\n",
"14 3000 365"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Wczytanie danych (mieszkania) przy pomocy biblioteki pandas\n",
"\n",
"alldata_p2 = pandas.read_csv('polynomial-regression_2.csv')\n",
"alldata_p2 = alldata_p2.sample(frac=1)\n",
"alldata_p2"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"# alldata = np.matrix(alldata[['sqrMetres', 'price']])\n",
"data_train_p2 = alldata_p2[0:12]\n",
"data_test_p2 = alldata_p2[12:]\n",
"data_train_p2 = np.matrix(data_train_p2).astype(float)\n",
"data_test_p2 = np.matrix(data_test_p2).astype(float)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Wielomian 1 stopnia, MSE = 13592.268823271697\n",
"Wielomian 2 stopnia, MSE = 9030.04916509696\n",
"Wielomian 3 stopnia, MSE = 9795.339194991013\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmcAAAFkCAYAAABlzpwiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAw7klEQVR4nO3dd5Tc9X3/++d7i9pq1dAihApqq5UBm2LRRQdJKI7t2I5lJ7GNjY3tYBsCBpL87v3l3pybkwDGNu7Bxi1xETHOzyShSHSEaQLTkbQrIVBFDUmrrt353D9mMGtZEio7853ZeT7OmTMz3+93Zl7nq93Ra7/tEyklJEmSVB5qsg4gSZKkt1jOJEmSyojlTJIkqYxYziRJksqI5UySJKmMWM4kSZLKSF3WAQ7F0KFD05gxY7KOIamSrF0LS5dCLvfH82pqYNQoGDq06DFe37Sd1e076NerlvFN/Yv+eZkqk3UuldJTTz21NqXUdDCvrehyNmbMGObNm5d1DEmV5Npr4frr9zwvl4OPfhT++Z+LGmHt5h2cff391O7s5NbPnsbJY4cU9fMyVwbrXCq1iHj1YF/rbk1J1aW5GRoa9jyvoQEmTCh6hG/f38aWnZ2cN+nwnl/MoCzWuVRJLGeSqsvMmfldaXtSU5OfX0RL12/lZ4+9RgRcPa2lqJ9VNjJe51KlsZxJqi6NjXDHHfn7N7fmNDS8Nb1/cY//+to9C9nZmeP9x4/gHcMHFPWzykbG61yqNBV9zJkkHZQpU2DFCpg1C9ra8rvVZs4sekmYv2oT//m75dTXBldeOLGon1V2MlrnUiWynEkqX+3t+f/MW1vzxy3NnJnf2tId+veHSy7pnvfaT1+5ewEpwV+echSjhvQr6WeX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dfG1OQvZ2ZnjvccdyTFHDsw6jqQqZDmTpIKFr7fz66eXUVcTXDV1YtZxJFUpy5kkFdxw9wJyCf7ilNEcdVhD1nEkVSnLmSQBT726njkvvU7f+lq+cN6ErONIqmKWM0lVL6XEdXfmh2n69JljObyxT8aJJFUzy5mkqvfAgjU8sWQ9g/rV85mzxmUdR1KVs5xJqmq5XOK6u+YDcNk5ExjQpz7jRJKqneVMUlX7r+dWMH9VO8MH9uFjpx2VdRxJspxJql47O3LcOHshAH9zwUT61NdmnEiSLGeSqtgvn3yN19ZvZcLh/fnAiSOyjiNJgOVMUpXasqODb9zbCsCXp7ZQV+vXoaTy4LeRpKr0w7mvsHbzTo4fNYhpxwzLOo4k/Z7lTFLVWb9lJ//60GIArp0+iYjIOJEkvcVyJqnqfOf+Njbv6ODsiU2cNv6wrONI0h+wnEmqKss3bOOnj74KwNXTWjJOI0l/rGjlLCL6RMQTEfFsRLwYEf9vYfrPImJBRLwQET+MiPrC9HMiYmNEPFO4/e9iZZNUvb4+ZyE7O3O897gjOXbEwKzjSNIfqSvie+8AzkspbS4UsLkRcSfwM+CvCsv8HPg08N3C84dTSu8pYiZJVaz19XZue3oZdTXBlRdOzDqOJO1R0cpZSikBmwtP6wu3lFK6481lIuIJYGSxMkhSVzfcvYBcgr88ZTRjhjZkHUeS9qiox5xFRG1EPAOsBuaklB7vMq8e+BhwV5eXnFbYDXpnRBxTzGySqstTr77B7Jdep299LV88f0LWcSRpr4pazlJKnSml48lvHTs5Io7tMvs7wEMppYcLz58GjkopHQd8E/g/e3rPiLg0IuZFxLw1a9YUL7ykHiOltwY3v2TKWA5v7JNxIknau5KcrZlS2gDcD0wHiIh/AJqAK7sssymltLnw+A6gPiKG7uG9bk4pTU4pTW5qaipFfEkV7oGFa3jilfUM6lfPpWePyzqOJO1TMc/WbIqIQYXHfYELgfkR8Wl
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
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Cw3cQG1Vhe5pXyZ36eXTjJ6hvBHOAERmdHJGB84MKGXSg1tWxF0OEu6BzcHPyH7WnaHMEc4ARGb/6SuaSbvuaV+m5tqquMtBwj2wKVx39gYjZyhvhDMAkfnJiWALjYdYb4ZF2BV2bB44O6DJmdmYqwHiQzgDEJnnw/VmD3PYORahpb5ad6xu1NRMWq/1DMZdDhAbwhmASAxNTOtQz6AqU6Zd4QajwM3sCrfUeJGpTZQxwhmASLx48rLSLu3c0KKGmsq4y0GReLCDpgCAcAYgEuxvhtuRWXe2//QVpdMeczVAPAhnACLB/ma4HeuX12vdsloNjk+rq28k7nKAWBDOAOTdldEpHekdUnVlKnugNbBYu7JHOTG1ifJEOAOQdy+8EYyavXVji2qrKmKuBsWGQ9BR7ghnAPLuJ2yhgSWYOymAjk2UJ8IZgLzLrjejGQC34Y5VTWqurVTPwLh6BsbjLgcoOMIZgLzqH55UV9+I6qoqdN/6lrjLQRFKpSy77owtNVCOCGcA8iqzhcaujuWqruRXDG7PLtadoYzxmxNAXjGliXx4oIND0FG+CGcA8uq58LBz9jfDUty7fpmqK1M6dmFYg2PTcZcDFBThDEDe9A6O69SlMTXWVOqe9mVxl4MiVlNZofvWBz9DL7/J1CbKC+EMQN5kpjQf3LxClRX8esHScAg6yhW/PQHkzdz+ZkxpYuk4BB3linAGIG8yI2cPsd4MefDWTctlJh08O6iJ6dm4ywEKhnAGIC/OXB5Tz8C4ltVVafva5rjLQQlYVlelt6xu0tRsWgfPDsZdDlAwhDMAefGTsEvzoS0rlEpZzNWgVDz
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmcAAAFkCAYAAABlzpwiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAAL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043tx8yGs6xk7gnrmvBuAdr5iVVfVFERH8zVvPpL42+Navnufh57ZlXVJJWPrcdvoSzJs2hlEjym+7LqlUFPKnZwrw9YioJRcCv5NS+n5E/DQiWoEAlgHvz19/L7llNFaTW0rj9wpYm6Qjufhi2LAhN/B/9epcV+aiRblgdphr7p4wj72bG7nolHHMmth8+NeuELMmtnDdq07hH+9fw813PcF/fODiqt/ge2AJDcebScelYOEspbQcOOcQxy85zPUJuL5Q9Ug6Ss3NcO21Q7ompcTtf/cAsIt3XnhSUcorBX/827O557ENPNXewb/832e57lUvy7qkTA1MBnC8mXRcqvvPPEnD4tG1O1jZtotxTSN4wxmTsi6naEaOqOV/X34mAJ+/bxXrd+zLuKLs7N3fw+PrdlITsMDxZtJxMZxJOm635/fRfPt506puL8XXzJnIm+ZNYV93L5/83pNZl5OZh5/bTk9f4sypY2hprM+6HKmsGc4kHZede7v5/vINALzjgspc2+ylfOLNc2luqOPHKzfyX0+2Z11OJg6MN7NLUzpehjNJx+W7j66js7uPi2dNYOaEw6yPVuEmjW7kT16f22vzL+95kj1dPRlXVHwuPisNH8OZpGOWUhro0qzUHQGG6pqXz2Te1DFs2NnJF3+
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"cost_fun_slices = []\n",
"for n in range(1, 4):\n",
" plot_and_mse(data_train_p2, data_test_p2, n)\n",
" \n",
" cost_data = cost_functions.get(n)\n",
" cost_x = [line[1] for line in cost_data[:250]]\n",
" cost_y = [line[0] for line in cost_data[:250]]\n",
" cost_fun_slices.append((cost_x, cost_y))"
]
},
{
"cell_type": "code",
"execution_count": 21,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnUAAAFkCAYAAABGlc33AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMi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DnSRJUgcw1EmSJHUAQ50kSVIHMNRJkiR1AEOdJElSBzDUSZIkdQBDnSRJUgcw1EmSJHUAQ50kSVIHMNRJkiR1AEOdJElSBzDUSZIkdQBDnSRJUgcw1EmSJHUAQ50kSVIHMNRJkiR1gOWtLqDlRkdh61YYHoa+PhgchN7eVlclSZI0J0s71O3cCevXw/g4jI1BdzdccQVs3w4DA62uTpIkqW51X36NiH/WyEKabnS0CnSjo1Wgg+p1ov3gwdbWJ0mSNAezhrqIeFNE7AF+UD6/PiI+3/DKGm3r1qqHbirj49VySZKkRaKenrrrgQuBZwAy83vAWxpZVFMMDx/uoZtsbAxGRppbjyRJ0hGo6/JrZj4+qenlBtTSXH191T10U+nuhrVrm1uPJEnSEagn1D0eEW8CMiJWRMS/Ax5qcF2NNzgIXdN8/a6uarkkSdIiUU+o+x3gMmA1sA84q3xe3Hp7q1Guvb2He+y6uw+39/S0tj5JkqQ5mHVKk8z8R+DdTail+QYGYP/+alDEyEh1yXVw0EAnSZIWnVlDXUT8NyAnt2fm+xpSUbP19MCmTa2uQpIk6YjUM/nwN2reHw28HdjfmHIkSZI0H/Vcfv1q7eeI+DKws2EVSZIkac7qfqJEjT7gf1noQiRJkjR/9dxTN0p1T12U1yeBKxtclyRJkuZg1p66zOzNzGNrXl87+ZLsVCLilIi4KyL2RMTuiPhwaf/9iNgXEfeXv/U121wdESMR8XBEXFj
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnUAAAFkCAYAAABGlc33AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpw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GOokSZK6gKFOkiSpCxjqJEmSuoChTpIkqQsY6iRJkrqAoU6SJKkLGOokSZK6gKFOkiSpCxjqJEmSuoChTpIkqQsY6iRJkrpAw6EuIv5RMwuRJEnS3M0Y6iLiDRHxKPCtMv26iPhk0ytrlVoNbrkFrr22eq/V2l2RJEnSrB3VwDI3ApcCGwEy8+sR8bNNrapVtm6F1athbAz274feXrjmGti0CYaG2l2dJElSwxo6/ZqZT05oOtSEWlqrVqsCXa1WBTqo3sfb9+1rb32SJEmz0EioezIi3gBkRBwdEb8JPNbkuppvw4aqh24yY2PVfEmSpAWikVD3K8BVwHJgF3BumV7Yduw43EM30f79MDra2nokSZKOwIzX1GXm3wPvbEEtrTUwUF1DN1mw6+2FlStbX5MkSdIczRjqIuK/AzmxPTN/qSkVtcrwcDUoYjI9PdV8SZKkBaKR0a9frPt8LPBWYHdzymmh/v5qlOvE0a89PVV7X1+7K5QkSWpYI6dfP1c/HRGfBbY2raJWGhqC3burQRGjo9Up1+FhA50kSVpwGumpm2gA+JH5LqRt+vpg3bp2VyFJknREGrmmrkZ1TV2U9+8B1za5LkmSJM3CjLc0ycz+zDy+7v01E0/JTiYiTouI+yLi0YjYHhHvK+2/ExG7IuLh8lpdt871ETEaEY9HxKV17atK22hEXFfXfmZ
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnUAAAFkCAYAAABGlc33AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAApUElEQVR4nO3de5SldX3n+/e3upvLVBVysQ/DdMPA2GUMuEaCFSRa4yJeoOl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kqQOYKiTJEnqAIY6SZKkDmCokyRJ6gCGOkmSpA5gqJMkSeoAhjpJkqQOYKiTJEnqAIY6SZKkDmCokyRJ6gB1h7qI+CeNLESSJEkLd8RQFxGvj4jHgO+U96+JiE83vDJJkiTVbXkd69wAXAxsAcjMb0XEGxtaVTONj8PmzTA6CgMDMDwM/f2trkqSJGle6gl1ZObTEVHbdKgx5TTZ9u2wbh1MTsLEBPT2wtVXw9atMDTU6uokSZLqVk+oezoiXg9kRKwAPgA83tiymmB8vAp04+OH2yYmqud162DPHujra01tkiRJ81TPQInfAK4EVgG7gXPL+6Vt8+aqh24mk5PVckmSpCXiiD11mfn3wLubUEtzjY4e7pmbbmICxsaaW48kSdJROGKoi4j/DuT09sx8b0MqapaBgeoaupmCXW8vrFnT/JokSZIWqJ7Tr18B/qw87gVOAPY3sqimGB6Gnlm+fk9PtVySJGmJqOf06xdr30fE7cD2hlXULP391SjX6aNfe3qqdgdJSJKkJaSuKU2mGQD+j8UupCWGhqpRrps3V9fQrVlT9dAZ6CRJ0hJTzzV141TX1EV5fga4psF1NU9fH2zc2OoqJEmSjsoRr6nLzP7MPKHm+ZXTT8nOJCJOj4j7IuKxiNgZER8o7b8bEbsj4uHyWFezzXURMRYRT0T
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
}
],
"source": [
"#WYKRESY FUNKCJI KOSZTU\n",
"for fig in cost_fun_slices:\n",
" cost_x, cost_y = fig\n",
" fig = plot_data_cost(cost_x, cost_y, \"Iteration\", \"Cost function value\")"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlwAAAFvCAYAAACfGhUuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcn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UOIcqcO0FzqNah8vAJUmS1IJWbl79EuBc4L7M/FXgdOCxRauSJEnqI60Erm9n5jxwMCKOA+4HTi5bliRJUv9oZQ7XVEQ8Dvgr4HpgFvjnkkVJkiT1k1YWPn1V8+X/jIhrgOMy86ayZUmSJPWPdYcUI+LDEfHyiBjMzDsNW5IkSYenlTlcbwHGgFsj4qqIeElEbFvvQ5IkSaq0MqT4KeBTEbGFanX5XwPeDRxXuDZJkqS+0OrCp8cCPwOMA2cCV5QsSpIkqZ+0svDpB4BnAtcA7wA+1VwmQpIkSS1opYfrXcDLMvNQ6WIkSZL6UStzuD7aiUIkSZL6VStXKUqSJOkItDRpfqMi4k6gARwCDmbmjpLHkyRJqqNWr1I8Efihpftn5qdbPMZzMvPrG6hNkiSpL7RyleIfUy0HcStVTxVAAq0GLkmSpE2tlR6unwWenJkHNvD9CXwsIhL4y8zcs3yHiLgIuAjgiU984gYOIUmSVG+tTJr/MrB1g98/lplnAucBF0fE2ct3yMw9mbkjM3eMjIxs8DCSJEn11UoP17eAGyPiE8B3e7ky89XrfTAz72k+3x8RV1MtoOpQpCRJ2lRaCVwfbj4OS0QMAgOZ2Wi+fj7wh4f7PZIkSb2ulYVPr4iIo4EfaTbdkZmPtPDdTwCujoiF47wvM6/ZcKWSJEk9qpWrFM+huln1nUAAJ0fEhestC5GZXwZOP/ISJUmSelsrQ4pvAZ6fmXcARMSPAFcCP16yMEmSpH7
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlwAAAFvCAYAAACfGhUuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgn0lEQVR4nO3de5RlZXnn8e9T3Q2NVYUKdkwCGAxd0aArICkvIRUXij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DPBXwDVUz1H855JFSZIk9ZNWFj59TfPP/xkRVwDHZub1ZcuSJEnqH4ccUoyIj0XEKyJiMDNvN2xJkiQdnlbmcL0VGANuiojLIuIlEbH1UF+SJElSpZUhxc8Bn4uITVSry/868F7g2MK1SZIk9YVWFz49Bvh5YBw4A3h/yaIkSZL6SSsLn34YeAZwBfAu4HPNZSIkSZLUglZ6uN4DvDwzD5YuRpIkqR+1Mofrk50oRJIkqV+1NIdrvSLidqABHAQOZOZoyfNJkiTVUdHA1fSczPxWB84jSZJUS63epXgC8CNL98/Mz5cqSpIkqZ+0cpfin1AtB3ET1dAgQAKtBK4EPhURCfxlZu5e4fjnA+cDPOEJT2ixbEmSpN7RSg/XLwBPysz96zj+WGbeFRE/AHw6Im5Z3jPWDGG7AUZHR3Md55AkSaq1Vh7tcxuwZT0Hz8y7mu/3ApdTreclSZK0obTSw/Vd4LqIuBL4916uzHztWl+KiEFgIDMbzb+fD/zhkRQrSZLUi1oJXB9rvg7X44HLI2LhPB/MzCvWcRxJkqSe1srCp++PiKOAH2s23ZqZD7XwvduA046wPkmSpJ7Xyl2KZ1E9rPp2IICTIuI8l4WQJElqTStDim8Fnp+ZtwJExI8BlwI/WbIwSZK
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAlwAAAFvCAYAAACfGhUuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgpElEQVR4nO3df5RkZ13n8fe3ZyaZ0N0BE0Z0J8FgpgUDZxOw+WFsOYEgklkk6kEbiC7KrBGJEhhXCe5x2V05B1cX0F2WrCMguEJoDGThwJiAMfwYVgOTbEiY/Nhuk2CSSchAMKlumElm+rt/3OqdTk//qOmup+pW9ft1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iIgNVKvL/xrwAeDkwrVJkiT1hVYXPj0J+BlgHHgO8KGSRUmSJPWTVhY+/RjwPOBq4D3AF5rLREiSJKkFrfRwvR94dWYeKV2MJElSP2plDtc1qz14RNwNNIAjwOHMHF3tsSRJknpVS3O41uhFmfmtDpxHkiSpllpZFkKSJElr0OpdiluBH5q/f2Z+sYWvJvDZiEjgzzJz16qqlCRJ6mGt3KX4n6mWg7iVai4WVEGqlcA1lpn3RcT3A5+LiNsXBrWIuBi4GOCpT33q8dQuSZLUE1rp4fpZ4OmZeeh4D56Z9zXfH4yIq6iWl/jign12AbsARkdH83jPIUmSVHetzOG6E9h0vAeOiMGIGJ77G3gp8PXjPY4kSVKva6WH67vATRFxLfD/e7ky840rfO8pwFURMXeej2Tm1astVJIkqVe1Erg+1Xwdl8y8Ezj7uCuSJEnqM60sfPqhiDgB+JFm0x2Z+VjZsiRJkvpHK3cpnkf1sOq7gQBOj4jXtrgshCRJ0rrXypDiO4GXZuYdABHxI8A
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"#WYKRESY FUNKCJI KOSZTU\n",
"for fig in cost_fun_slices:\n",
" cost_x, cost_y = fig\n",
" fig = plot_data_cost(cost_x, cost_y, \"Iteration\", \"Cost function value\")"
]
},
{
"cell_type": "code",
"execution_count": 10,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [],
"source": [
"# Ilość nauki do oceny"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 11,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [
{
"data": {
2022-06-21 16:42:59 +02:00
"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>number_courses</th>\n",
" <th>time_study</th>\n",
" <th>Marks</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>3</td>\n",
" <td>4.508</td>\n",
" <td>19.202</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>4</td>\n",
" <td>0.096</td>\n",
" <td>7.734</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>4</td>\n",
" <td>3.133</td>\n",
" <td>13.811</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>6</td>\n",
" <td>7.909</td>\n",
" <td>53.018</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>8</td>\n",
" <td>7.811</td>\n",
" <td>55.299</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>95</th>\n",
" <td>6</td>\n",
" <td>3.561</td>\n",
" <td>19.128</td>\n",
" </tr>\n",
" <tr>\n",
" <th>96</th>\n",
" <td>3</td>\n",
" <td>0.301</td>\n",
" <td>5.609</td>\n",
" </tr>\n",
" <tr>\n",
" <th>97</th>\n",
" <td>4</td>\n",
" <td>7.163</td>\n",
" <td>41.444</td>\n",
" </tr>\n",
" <tr>\n",
" <th>98</th>\n",
" <td>7</td>\n",
" <td>0.309</td>\n",
" <td>12.027</td>\n",
" </tr>\n",
" <tr>\n",
" <th>99</th>\n",
" <td>3</td>\n",
" <td>6.335</td>\n",
" <td>32.357</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>100 rows × 3 columns</p>\n",
"</div>"
],
2022-06-20 20:34:11 +02:00
"text/plain": [
" number_courses time_study Marks\n",
"0 3 4.508 19.202\n",
"1 4 0.096 7.734\n",
"2 4 3.133 13.811\n",
"3 6 7.909 53.018\n",
"4 8 7.811 55.299\n",
".. ... ... ...\n",
"95 6 3.561 19.128\n",
"96 3 0.301 5.609\n",
"97 4 7.163 41.444\n",
"98 7 0.309 12.027\n",
"99 3 6.335 32.357\n",
"\n",
"[100 rows x 3 columns]"
2022-06-21 16:42:59 +02:00
]
2022-06-20 20:34:11 +02:00
},
2022-06-21 16:42:59 +02:00
"execution_count": 11,
2022-06-20 20:34:11 +02:00
"metadata": {},
2022-06-21 16:42:59 +02:00
"output_type": "execute_result"
2022-06-20 20:34:11 +02:00
}
],
"source": [
"data_marks_all = pandas.read_csv('Student_Marks.csv')\n",
"data_marks_all"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 12,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [],
"source": [
"data_marks_all = data_marks_all[['time_study', 'Marks']]\n",
"# data_marks_all = data_marks_all.sample(frac=1)\n",
"data_marks_train = data_marks_all[0:70]\n",
"data_marks_test = data_marks_all[70:]\n",
"data_marks_train = np.matrix(data_marks_train).astype(float)\n",
"data_marks_test = np.matrix(data_marks_test).astype(float)"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 13,
2022-06-20 20:34:11 +02:00
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
2022-06-21 16:42:59 +02:00
"output_type": "stream",
2022-06-20 20:34:11 +02:00
"text": [
2022-06-21 16:42:59 +02:00
"Wielomian 1 stopnia, MSE = 381.16937283505433\n",
2022-06-20 20:34:11 +02:00
"Wielomian 2 stopnia, MSE = 394.1863119057109\n",
2022-06-21 16:42:59 +02:00
"Wielomian 3 stopnia, MSE = 391.5017110730558\n"
2022-06-20 20:34:11 +02:00
]
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmAAAAFkCAYAAACHEodbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMi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gPsnjqFLpzSXIxJxhxIwERGJiepaP9OKiqmps/zw+EGcMqKn2yGJuEYJmIiIxMTD75SwcvNeBnXL4obxh7odjoirojaMW0REEpzXC0VFUFICeXlQUAC5ua26VfGG3Tzy7hqMgQcm55Odof/8SMemPwEiInKgRYtgwgTw+8Hng+xsmDYNFiyAceMiulVlTR3Tnyumzm/5+clDOXZotygFLZI4tAUpIiL783qd5MvrdZIvcL42vF5eHtHtZr6xmtJt5QzvlcP0sw+JQsAiiUcJmIiI7K+oyFn5CsTvd46H6ZOvd/Lkoq9J8RhmTs4nMy2lnYIUSWxKwEREZH8lJY0rX835fFBaGtZtfFW1XPNcMdbCFaceTP7Aru0Xo0iCUwImIiL7y8tzar4Cyc6G4cPDus29r37JNzsrGNW3M1eenteOAYokPiVgIiKyv4IC8AT5z4PH4xxvwftfbef//vMNaSmGmVPySU/Vf25EmtKfCBER2V9urvO0Y25u40pYdnbj6zk5IS/fs6+GwrlLAbj6rBEc2rdztCMWSThqQyEiIgcaNw7KypyC+9JSZ9uxoKDF5AvgjpdWsnlPJUcO6srlJw+LQbAiiUcJmIiIBJaTA1OnRnTJGyu2MPfzjWSmeZg5OZ/UFG20iASiPxkiItIudvqqufGFZQBc992RDOvZ8mqZSEelBEx
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmAAAAFkCAYAAACHEodbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABKpUlEQVR4nO3deXxU9b3/8dd3spKFLexhX2QXFAQV3MAVcakLqbXVWvqzi9Zae2+lvb31trW119t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yGq0cHeoLpbkgRkfre3riPEzV1nN23I/kd27kdjkjcUgIWRGAbcu7qYnw+bUOKiAScuvtRq18iraEELIiz+nSiV4dMio9WsnK3q3PCRURihreyhsWb92MMXK36L5FWUQIWhMdjmD7G+e3udTVlFREBYNHGMqprfZzTvzPd22e6HY5IXFMCFkLg7p55a0uo0zakiMjJX0iv0eqXSKspAQthdH4H+uVlsd9bxSfbD7odjoiIq45W1LCkcD8eA1eOUgIm0lpKwEIwxpzs8KxtSBFJdgvWl1JTZzlvkNOqR0RaRwlYI6b774Z8Y10JNXU+l6MREXHP67r7UaRNKQFrxNDuuQzplsORiho+KDrgdjgiIq44eLyKD7ceJNVjuHJkD7fDEUkISsAaYYw5+duetiFFJFm9ub6UOp9l0uAudMpOdzsckYSgBKwJgW3It9aXUlVb53I0IiJR5PXC7NnMfWkpANPP6ORyQCKJQwlYEwZ1zWFkr/Z4q2p5b/N+t8MREYmOpUshP599P3qAT2wu6XU1XH79Bc7zItJqSsDCcHI
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmAAAAFkCAYAAACHEodbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAA/qElEQVR4nO3deXzV5Zn38c+dfSdACIQQFk0AAQUEV6jFDZS665D26bTWsWMXp1OH9qm2T592pqt1ptP6TNvpWGu1i4pVrFRpBRWsUVF22QmyJwEStpzsyTn388fvhIRwzsk5Sc6a7/v1yivJbzm5OAa9vO/rd13GWouIiIiIRE5StAMQERERGWyUgImIiIhEmBIwERERkQhTAiYiIiISYUrARERERCJ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KMEjAREenq/XVxsf+Lysqcmi9fsrOdeZEiEhQlYCIig9yB442sO3CSrLRkFkwd5f/C8nJI8vOfjaQk57yIBEUJmIjIILd0QxUAN0wbRXZ6gIfjc3Odpx1zc7tWwrKzu47n5EQgWpHEoDYUIiKDmLW26+nHYEYPzZ0L1dVOwf2ePc62Y3m5ki+RECkBExEZxNYdOMmhE82MysvgivOHB3dTTg7ce294AxNJcNqCFBEZxDqL72+bWUxyko/eXyISFkrAREQGqZZ2Ny9/UAP08vSjiAw4bUGKiAxSr+04iqulgwuLhzBxZIBZjpr9KDLglICJiAxSnU8/Blz90uxHkbDQFqSIyCBU62r
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
}
],
"source": [
"cost_fun_slices = []\n",
"\n",
"for n in range(1, 4):\n",
" plot_and_mse(data_marks_train, data_marks_test, n)\n",
" \n",
" cost_data = cost_functions.get(n)\n",
" cost_x = [line[1] for line in cost_data[:250]]\n",
" cost_y = [line[0] for line in cost_data[:250]]\n",
" cost_fun_slices.append((cost_x, cost_y))"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 14,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmgAAAFkCAYAAACUxcevAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAj/UlEQVR4nO3de5CldX3n8fe3Z7ilu5XbSE2GYTFMq0FrGUlLiHYsBE1gKgkajQ0xSnQWNGC8jJsAbmU1Gy3NRYiuyu4oRMiiNgUaKJ1oEPEy2RUcyMhVdlouBcwAIyD0N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F3UawAPa/uFZySJEmLSGQ+5xZnHWNwcDA3bdrU7jIkSZKeJSJuycw573oxk7o2S4+IlwHHUtwHDYDMvGKhv1SSJEkzq2cV54eAkygC2gbgNGAjxS4BkiRJarB67oP2JuAU4JHMfDtwHPD8plYlSZLUxeoJaP+emRPA7oh4HvAYz74dhiRJkhqonjlomyLiYOBzwC3ADuD/NLMoSZKkblbPjWrPLZ/+j4j4BvC8zLytuWVJkiR1rzmHOCPiuoj4w4jozcz7DWeSJEnNVc8ctE8AQ8BdEXF1RLwpIg6c6yRJkiQtTD1DnN8FvhsRSyh2DzgbuAx4XpNrkyRJ6kr13qj2IOB3gWHgeODyZhYlSZLUzeq5Ue1VwAnAN4BPA98tb7shSZKkJqinB+1S4Ew3LpckSWqNeuagfbMVhUiSJKlQzypOSZIktZABTZIkqWLqXcW5AvgPte/PzO81qyhJkqRuVs8qzr+muL3GXcDkQoEEDGiSJElNUE8P2uuBF2fmribXIkmSJOqbg3YvsF+zC5EkSVKhnh60Z4DNEXED8P970TLzPU2rSpIkqYv
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmgAAAFkCAYAAACUxcevAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAi8klEQVR4nO3dfZBldX3n8fe3h+EhPa0I9FLsMBWUaaPoLiNpidGOheADTCWBpFwbNEp0VjSOiS4mC7iVNVtJSqIRNm6UKnyIsKvQFOpC6UQlhAQnq2IPO/Io261i8TAwEyXY08qMM/3dP87pzKXph9MP995z+75fVbfuvb9zzr3fzvFOPvzO73d+k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RJXSUidmTm4FKPX/ASZ0TcHBFvjIjezHywLuHsGSYminA2MVGEMyiep9v37m1vfZIkSRVVGYP2EWAIuC8iboyI10fEkQsd1HIjI0XP2WymportkiRJHaDKWpz/CPxjRKyhWD3g7cCngWc1ubbFGRs71HM20+QkjI+3th5JkqQlqnqj2qOA3wCGgdOAa5pZ1JIMDBRjzmYLab29sHFj62uSJElagipj0G4A7qfoPftr4OTM/P1mF7Zow8PFhIDZ9PQU2yVJkjpAlR60TwEXZObBZhezLH19xWzNuWZxrlvX7golSZIqqTIG7autKGRFDA3Bo48WEwLGx4vLmsPDhjNJktRRKo1B6yjr1sGWLe2uQpIkacmq3GZDkiRJLVR1Fud64Bcb98/M25tVlCRJUjdbMKBFxF9Q3F7jPmB6okACBjRJkqQmqNKDdh7wS5m5r8m1SJIkiWpj0L4PrG12IZIkSSpU6UH7KbAzIm4F/rUXLTP/oGlVSZIkdbEqAe3m8iFJkqQ
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmgAAAFkCAYAAACUxcevAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAiv0lEQVR4nO3dfZRddX3v8fd3AgQ6MxaBNCtNYlEy1qKrRBqR2rlcFB8gqxbtso5IlaW5jdZwi8bbAt7Vq12tS/ogVKvlXhRq6FUIC/TC0lRKKT7EewUHbuRROiPqIg+QiBYngyQk871/7D03h2EeTmbmnLPPnPdrrbPO2b/9cL7j9sCH32//9o7MRJIkSdXR1eoCJEmS9GwGNEmSpIoxoEmSJFWMAU2SJKliDGiSJEkVY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EIoqnB/wBcA3wvAbXJkmS1JHqvVHtMcAbgQHgVGBTI4uSJEnqZPXcqPYG4DTgq8CngK+Xt92QJElSA9TTg3Y1cF5mHmx0MZIkSarvGrRbm1GIJEmSCvXM4pQkSVITGdAkSZIqpt5ZnMuBX6ndPjO/0aiiJEmSOlk9szj/kuL2Gg8C4xMFEqhmQBsZgc2bYWgI+vpgYAB6e1tdlSRJUt3q6UF7E/CrmbmvwbXM3datsHYtjI3B6Ch0d8PGjbBlC/T3t7o6SZKkutRzDdojwJGNLmTORkaKcDYyUoQzKN7H2/fubW19kiRJdaqnB+0pYFtE3A78/160zPyjhlU1G5s3Fz1nkxkbK9avW9fcmiRJkmahnoB2S/mqtqGhQz1nE42OwvBwc+uRJEmapXpuVLspIo4CXlw2PZyZzzS2rFno6yuuOZsspHV3w6pVza9JkiRpFma8Bi0izgSGgE8Dfw/8W0S
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
}
],
"source": [
"#WYKRESY FUNKCJI KOSZTU\n",
"for fig in cost_fun_slices:\n",
" cost_x, cost_y = fig\n",
" fig = plot_data_cost(cost_x, cost_y, \"Iteration\", \"Cost function value\")"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 15,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [
{
"data": {
2022-06-21 16:42:59 +02:00
"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>sex</th>\n",
" <th>bmi</th>\n",
" <th>children</th>\n",
" <th>smoker</th>\n",
" <th>region</th>\n",
" <th>charges</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>55</td>\n",
" <td>female</td>\n",
" <td>32.775</td>\n",
" <td>2</td>\n",
" <td>no</td>\n",
" <td>northwest</td>\n",
" <td>12268.63225</td>\n",
" </tr>\n",
" <tr>\n",
" <th>412</th>\n",
" <td>26</td>\n",
" <td>female</td>\n",
" <td>17.195</td>\n",
" <td>2</td>\n",
" <td>yes</td>\n",
" <td>northeast</td>\n",
" <td>14455.64405</td>\n",
" </tr>\n",
" <tr>\n",
" <th>547</th>\n",
" <td>54</td>\n",
" <td>female</td>\n",
" <td>46.700</td>\n",
" <td>2</td>\n",
" <td>no</td>\n",
" <td>southwest</td>\n",
" <td>11538.42100</td>\n",
" </tr>\n",
" <tr>\n",
" <th>983</th>\n",
" <td>27</td>\n",
" <td>female</td>\n",
" <td>30.590</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>northeast</td>\n",
" <td>16796.41194</td>\n",
" </tr>\n",
" <tr>\n",
" <th>661</th>\n",
" <td>57</td>\n",
" <td>female</td>\n",
" <td>23.980</td>\n",
" <td>1</td>\n",
" <td>no</td>\n",
" <td>southeast</td>\n",
" <td>22192.43711</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",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>827</th>\n",
" <td>36</td>\n",
" <td>male</td>\n",
" <td>28.025</td>\n",
" <td>1</td>\n",
" <td>yes</td>\n",
" <td>northeast</td>\n",
" <td>20773.62775</td>\n",
" </tr>\n",
" <tr>\n",
" <th>212</th>\n",
" <td>24</td>\n",
" <td>male</td>\n",
" <td>28.500</td>\n",
" <td>2</td>\n",
" <td>no</td>\n",
" <td>northwest</td>\n",
" <td>3537.70300</td>\n",
" </tr>\n",
" <tr>\n",
" <th>940</th>\n",
" <td>18</td>\n",
" <td>male</td>\n",
" <td>23.210</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>southeast</td>\n",
" <td>1121.87390</td>\n",
" </tr>\n",
" <tr>\n",
" <th>476</th>\n",
" <td>24</td>\n",
" <td>male</td>\n",
" <td>28.500</td>\n",
" <td>0</td>\n",
" <td>yes</td>\n",
" <td>northeast</td>\n",
" <td>35147.52848</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1027</th>\n",
" <td>23</td>\n",
" <td>male</td>\n",
" <td>18.715</td>\n",
" <td>0</td>\n",
" <td>no</td>\n",
" <td>northwest</td>\n",
" <td>21595.38229</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>1338 rows × 7 columns</p>\n",
"</div>"
],
2022-06-20 20:34:11 +02:00
"text/plain": [
2022-06-21 16:42:59 +02:00
" age sex bmi children smoker region charges\n",
"27 55 female 32.775 2 no northwest 12268.63225\n",
"412 26 female 17.195 2 yes northeast 14455.64405\n",
"547 54 female 46.700 2 no southwest 11538.42100\n",
"983 27 female 30.590 1 no northeast 16796.41194\n",
"661 57 female 23.980 1 no southeast 22192.43711\n",
"... ... ... ... ... ... ... ...\n",
"827 36 male 28.025 1 yes northeast 20773.62775\n",
"212 24 male 28.500 2 no northwest 3537.70300\n",
"940 18 male 23.210 0 no southeast 1121.87390\n",
"476 24 male 28.500 0 yes northeast 35147.52848\n",
"1027 23 male 18.715 0 no northwest 21595.38229\n",
2022-06-20 20:34:11 +02:00
"\n",
"[1338 rows x 7 columns]"
2022-06-21 16:42:59 +02:00
]
2022-06-20 20:34:11 +02:00
},
2022-06-21 16:42:59 +02:00
"execution_count": 15,
2022-06-20 20:34:11 +02:00
"metadata": {},
2022-06-21 16:42:59 +02:00
"output_type": "execute_result"
2022-06-20 20:34:11 +02:00
}
],
"source": [
"data_ins = pandas.read_csv('insurance.csv')\n",
"data_ins = data_ins.sample(frac=1)\n",
"data_ins"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 16,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [],
"source": [
"data_ins = data_ins[['age', 'charges']]\n",
"data_ins_train = data_ins[0:1200]\n",
"data_ins_test = data_ins[1200:]\n",
"data_ins_train = np.matrix(data_ins_train).astype(float)\n",
"data_ins_test = np.matrix(data_ins_test).astype(float)"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": 17,
2022-06-20 20:34:11 +02:00
"metadata": {},
"outputs": [
{
"name": "stdout",
2022-06-21 16:42:59 +02:00
"output_type": "stream",
2022-06-20 20:34:11 +02:00
"text": [
2022-06-21 16:42:59 +02:00
"Wielomian 1 stopnia, MSE = 178360681.2241408\n",
"Wielomian 2 stopnia, MSE = 179170879.99336478\n"
2022-06-20 20:34:11 +02:00
]
},
{
2022-06-21 16:42:59 +02:00
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/tmp/ipykernel_5896/1100858333.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mn\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m4\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mplot_and_mse\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata_ins_train\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdata_ins_test\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0mcost_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcost_functions\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/tmp/ipykernel_5896/3773219878.py\u001b[0m in \u001b[0;36mplot_and_mse\u001b[0;34m(data, data_test, n)\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;34m\"\"\"Wykres wraz z MSE\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_poly_data\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 12\u001b[0;31m \u001b[0mmodel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlogs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpolynomial_regression\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 13\u001b[0m \u001b[0mcost_function\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0melement\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0melement\u001b[0m \u001b[0;32min\u001b[0m \u001b[0menumerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlogs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0mcost_functions\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcost_function\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/tmp/ipykernel_5896/1168100012.py\u001b[0m in \u001b[0;36mpolynomial_regression\u001b[0;34m(X, y, n)\u001b[0m\n\u001b[1;32m 30\u001b[0m \u001b[0;34m\"\"\"Funkcja regresji wielomianowej\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0mtheta_start\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmatrix\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 32\u001b[0;31m \u001b[0mtheta\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlogs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgradient_descent\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcost\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mgradient\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtheta_start\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 33\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;32mlambda\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mh_poly\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtheta\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlogs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/tmp/ipykernel_5896/1641407440.py\u001b[0m in \u001b[0;36mgradient_descent\u001b[0;34m(fJ, fdJ, theta, X, y, alpha, eps)\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0mlogs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcurrent_cost\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtheta\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 18\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 19\u001b[0;31m \u001b[0mtheta\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtheta\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0malpha\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mfdJ\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtheta\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 20\u001b[0m \u001b[0mcurrent_cost\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mprev_cost\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfJ\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtheta\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcurrent_cost\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 21\u001b[0m \u001b[0;31m# print(current_cost)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/tmp/ipykernel_5896/1641407440.py\u001b[0m in \u001b[0;36mgradient\u001b[0;34m(theta, X, y)\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mgradient\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtheta\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;34m\"\"\"Wersja macierzowa gradientu funkcji kosztu\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 12\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0;36m1.0\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mT\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mX\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mtheta\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 13\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mgradient_descent\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfJ\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfdJ\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtheta\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0malpha\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0.1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meps\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m7\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.local/lib/python3.8/site-packages/numpy/matrixlib/defmatrix.py\u001b[0m in \u001b[0;36m__array_finalize__\u001b[0;34m(self, obj)\u001b[0m\n\u001b[1;32m 165\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mret\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 166\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 167\u001b[0;31m \u001b[0;32mdef\u001b[0m \u001b[0m__array_finalize__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 168\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_getitem\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 169\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmatrix\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_getitem\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
2022-06-20 20:34:11 +02:00
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnMAAAFkCAYAAABLi72wAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABfvElEQVR4nO3deXhV5bk3/u+zM0/MyJBko4ii4MAQEm2prUNR4lgZAuE60h77+h5FK9r+KvY9v1/P255W6jm29RzR1kP7iudlQxAnRBDno5xqQkBRQDA4sBOSMMi0E8i08/z+eNYiOztrrb32PH0/15UrydrTsxOB2/t57vsWUkoQERERUXJyxHsBRERERBQ6BnNERERESYzBHBEREVESYzBHRERElMQYzBERERElMQZzREREREksM94LiLURI0bIc889N97LICKKjqYm4NAh89tHjwaKi2O3HiKybfv27UellCODfVzaBXPnnnsu6uvr470MIqLoWLkSWLoUaG8feFtBAfDP/wzceWfMl0VEgQkhDoTyOG6zEhHFgsejAq2HHlKfPZ7ovE5VFeAw+avd4VC3E1FKSbvMHBFRzG3dClRWAr29KmNWUAA8+CCwaRMwc2ZkX6uoSD2v/+s5HOp6YWFkX4+I4o7BHBFRNHk8KrDyzcTpW6CVlUBzc+QDrJkz1fPW1AD79wMTJqiMHAM5opTEYI6IKJpqalSGzEhvr7o9GmfYCgt5No4oTfDMHBFRNDU0GBcjAOr6/v2xXQ8RpRwGc0RE0XTBB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9bmXLweWLQv9NfXn9XqB06cD37+gAHj
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
},
{
"data": {
2022-06-21 16:42:59 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnMAAAFkCAYAAABLi72wAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAABm0UlEQVR4nO3dd5jU1dn/8ffZzhZ6lSIoRbGhrp2YYCGKXRGMJmLEmChqsPwU8+R5zKNJRBKTmMcSDRohUcEaiYLGWKLEgqCi0qSI0nuZXbbOnt8fZ8ad3Z1edmZ2P6/r2mtmv/Od+Z6ZAbk959z3bay1iIiIiEh2ykn3AEREREQkfgrmRERERLKYgjkRERGRLKZgTkRERCSLKZgTERERyWIK5kRERESyWF66B9DaunfvbgcOHJjuYYiIpMb69bBlS+jHe/eGvn1bbzwiErVFixZtt9b2iPV57S6YGzhwIAsXLkz3MEREUmP6dJg8GSorWz5WUgK//CVMnNjqwxKRyIwxX8XzPC2zioi0Bo/HBVq33eZuPZ7UXGf8eMgJ8Z/2nBz3uIi0Ke1uZk5EpNXNnw9jxkBDg5sxKymBm26CuXNh5MjkXquszL1u8+vl5LjjpaXJvZ6IpJ2CORGRVPJ4XGAVOBPnXwIdMwY2bkx+gDVypHvd2bNh1SoYPNjNyCmQE2mTFMyJiKTS7NluhiyYhgb3eCr2sJWWam+cSDuhPXMiIqm0cmXwZARwx1etat3xiEibo2BORCSVhgxxe9aCKSlxS6AiIglQMCcikkrKLhWRFFMwJyKSSv7s0rKyxhm6kpLG40pKEJEEKQFCRCTVlF0qIimkYE5EpDUou1REUkTLrCIiIiJZTMGciIiISBbTMquISDbzeNxevJUr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GLPQd62qMec0Ys9J328V33Bhj/miMWWWM+dQYc1TA60zwnb/SGDMh4PjRvtdf5Xtu8hueiUjr8JfBKCtrnKErKWk8ruQHEckAf/nPl/z2n19gDPxu/AhOG94r3UNqldIko6y12wN+nwK8bq2daoyZ4vv9NuBMYIjv5zjgIeA4Y0xX4A6gHLDAImPMHGvtLt85PwI+AOYCZwDzWuE9iUgqqAxG26F6gdIGPf3hOv73H0sBmHrhYZx7xH5pHpGTjjpz5wHf8d2fAbyFC+bOA2ZaVyvlfWNMZ2NMH9+5r1lrdwIYY14DzjDGvAV0tNa+7zs+EzgfBXMi2a20FCZOTPcoJBGqFyht0EufbmTK858C8N9nD2f8MQPSPKJGqd4zZ4F/GmMWGWOu9h3rZa3d5Lu/GfDPT/YF1gU8d73vWLjj64Mcb8EYc7UxZqExZuG2bdsSeT8iIhKOx+MCOY+nMTu5srLxeEVFescnEofXl21h8qxPaLBw0+lDmThyULqH1ESqg7mR1tqjcEuok4wxJwc+6JuFS3nVYmvtI9bacmtteY8ePVJ9ORGR7OfxwPTpcNtt7jZYMedgVC9Q2pg3lm/hmr99RH2D5ccnH8D1p2ReZn1Kl1mttRt8t1uNMS8AxwJbjDF9rLWbfMuoW32nbwD6Bzy9n+/YBhqXZf3H3/Id7xfkfBERSUS8y6QeDzz7rOoFSpvx5vKt/OSvH1HrbeCHJw1kypkHkYm5limbmTPGlBhjyvz3gdHA58AcwJ+ROgF40Xd/DnC5L6v1eGCPbzn2VWC0MaaLL/N1NPCq77G9xpjjfVmslwe8lohI+xbvzFq4ZdJTToH77w/+WvPnu3Zsb70V+rVVL1CyyJsrtvLjvy6i1tvAFScO5H/OHp6RgRyksDerMeYA4AXfr3nAk9baXxljugFPAwOAr4Bx1tqdvoDsflxG6j7gh9ZafzmTK4Gf+V7rV9bav/iOlwOPAx1wiQ/
"text/plain": [
"<Figure size 691.2x388.8 with 1 Axes>"
]
2022-06-20 20:34:11 +02:00
},
"metadata": {
"needs_background": "light"
2022-06-21 16:42:59 +02:00
},
"output_type": "display_data"
2022-06-20 20:34:11 +02:00
}
],
"source": [
"cost_fun_slices = []\n",
"\n",
"for n in range(1, 4):\n",
" plot_and_mse(data_ins_train, data_ins_test, n)\n",
" \n",
" cost_data = cost_functions.get(n)\n",
" cost_x = [line[1] for line in cost_data[:250]]\n",
" cost_y = [line[0] for line in cost_data[:250]]\n",
" cost_fun_slices.append((cost_x, cost_y))"
]
},
{
"cell_type": "code",
2022-06-21 16:42:59 +02:00
"execution_count": null,
2022-06-20 20:34:11 +02:00
"metadata": {},
2022-06-21 16:42:59 +02:00
"outputs": [],
2022-06-20 20:34:11 +02:00
"source": [
"#WYKRESY FUNKCJI KOSZTU\n",
"for fig in cost_fun_slices:\n",
" cost_x, cost_y = fig\n",
" fig = plot_data_cost(cost_x, cost_y, \"Iteration\", \"Cost function value\")"
]
}
],
"metadata": {
"author": "Paweł Skórzewski",
"celltoolbar": "Slideshow",
"email": "pawel.skorzewski@amu.edu.pl",
"kernelspec": {
2022-06-21 16:42:59 +02:00
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
2022-06-20 20:34:11 +02:00
},
"lang": "pl",
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
2022-06-21 16:42:59 +02:00
"version": "3.8.12"
2022-06-20 20:34:11 +02:00
},
"livereveal": {
"start_slideshow_at": "selected",
"theme": "white"
},
"subtitle": "5.Regresja wielomianowa. Problem nadmiernego dopasowania[wykład]",
"title": "Uczenie maszynowe",
"year": "2021"
},
"nbformat": 4,
"nbformat_minor": 4
2022-06-21 16:42:59 +02:00
}