1
Fork 0
solar-conflux/python/denoising/Main.ipynb

269 lines
282 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"id": "9785abf6",
"metadata": {},
"source": [
"We have:\n",
"$$\n",
"\\nabla f = (I + \\beta A) \\vec s - \\vec y\n",
" = \\vec s - \\vec y + \\beta A \\vec s\n",
"$$ \n",
"We can substitute in the partial derivatives:\n",
"$$ \n",
"\\left(\\begin{matrix}\n",
"s_0 - y_0 + \\beta (s_0 - s_1) \\\\\n",
"s_1 - y_1 + \\beta (2s_1 - s_0 - s_2) \\\\\n",
"\\vdots \\\\\n",
"s_N - y_N + \\beta (s_N - s_{N - 1})\n",
"\\end{matrix}\\right) \n",
"= \\vec s - \\vec y + \\beta A \\vec s\n",
"$$\n",
"\n",
"Adding $\\vec y - \\vec s$ to both sides and then dividing by $\\beta$ yields:\n",
"$$ \n",
"\\left(\\begin{matrix}\n",
"s_0 - s_1 \\\\\n",
"2s_1 - s_0 - s_2 \\\\\n",
"\\vdots \\\\\n",
"s_N - s_{N - 1}\n",
"\\end{matrix}\\right) \n",
"= A \\vec s\n",
"$$\n",
"\n",
"Solving for $A$ is trivial and yields:\n",
"$$ \n",
"A = \\left(\\begin{matrix}\n",
"1 & -1 & & & & & \\\\\n",
"-1 & 2 & -1 & & & & \\\\\n",
" & -1 & 2 & -1 & & & \\\\\n",
" & & \\ddots & \\ddots & \\ddots & & \\\\\n",
" & & & -1 & 2 & -1 & \\\\\n",
" & & & & -1 & 2 & -1\\\\\n",
" & & & & & -1 & 1\n",
"\\end{matrix}\\right) \n",
"$$"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "e7d69a97",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import modules.tridiagonal as tridiagonal\n",
"\n",
"def sample_with_noise(points, vectorized_g):\n",
" \"\"\"\n",
" Sample a function at a given set of points,\n",
" introducing noise in the process.\n",
"\n",
" Returns a tuple of the real values of the function\n",
" and the values with introduced noise.\n",
"\n",
" For performance reasons, this function takes in\n",
" a vectorized version of `g`. If you want to pass\n",
" a non vectorized function use `np.vectorize`. Eg:\n",
" ```py\n",
" sample_with_noise(points, np.vectorize(g))\n",
" ```\n",
" \"\"\"\n",
" gs = vectorized_g(points)\n",
" ys = gs + 0.05 * np.random.randn(len(gs))\n",
"\n",
" return (gs, ys)\n",
"\n",
"def p5(x):\n",
" \"\"\"\n",
" Vectorized version of the function\n",
" described in the pdf.\n",
" \"\"\"\n",
" n = 5\n",
" result = 0\n",
"\n",
" for k in range(n + 1):\n",
" result += x**k\n",
"\n",
" return result/(n + 1)\n",
"\n",
"def smooth(data, beta):\n",
" \"\"\"\n",
" Smooth noisy data (y) by means of solving \n",
" a minimization problem.\n",
"\n",
" Args:\n",
" data (numpy.array): noisy data to be smoothed (y)\n",
" beta (float): parameter >= 0 that balances fit and smoothing\n",
"\n",
" Returns:\n",
" numpy array of smoothed data (s)\n",
" \"\"\"\n",
" x,y = data\n",
"\n",
" # We need to solve for s in:\n",
" # (I + βA)s - y = 0\n",
" # <=> (I + βA)s = y\n",
" #\n",
" # Because A and I are tridiagonal, I + βA\n",
" # is tridiagonal as well (linear combinations\n",
" # of tridiagonal matrices are themselves\n",
" # tridiagonal)\n",
" #\n",
" # This means we can use our existing implementation\n",
" # of tridiagonal linear equation system solving.\n",
" # \n",
" # We start by constructing \n",
" # iba := I + βA\n",
" n = len(x) - 1\n",
"\n",
" # The a component of the a-c-e tridiagonal representation of iba\n",
" iba_a = np.ones(n + 1) * (2 * beta + 1)\n",
" iba_a[0] = 1 + beta\n",
" iba_a[-1] = 1 + beta\n",
"\n",
" # I + βA\n",
" iba = (\n",
" iba_a,\n",
" -beta*np.ones(n),\n",
" -beta*np.ones(n)\n",
" )\n",
"\n",
" data_smoothed = tridiagonal.solve(*iba, y)\n",
"\n",
" return data_smoothed"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "2b9f2b79",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANS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GIwsLCGDduHHq9nhdffBEwPfhUVc3Qafa7777DYDBYbHuw1iNd+sPzwXPcPyIrO+3bt+fUqVMcP37cYvsvv/xi8b5Vq1a4ubkREhJCcHBwpi87O7tcXTNdegfkn3/+2WL7ihUriI+Pz9BBOStOTk5069aNt956i5SUFE6dOpWnODLTtm1b4uLiWLduncX2pUuXPtR5u3Tpgo2NDRcvXszyc8xM9erVefvtt6lXrx5Hjhwxbw8MDOSff/6xKLt161bu3buXYyxZ/Uw9WKZt27bMmjULIMOILiGKO6m5EaKAnDx50tyXIiIigl27drFw4UK0Wi2rVq0y11K4urrSpk0bPvroIzw9PQkMDGTHjh18//33uLm5WZyzbt26AHzzzTe4uLig0+kICgqiZs2aVKlShYkTJ6KqKu7u7vz555+5ap4BeP3111mwYAE9evTgvffeM4+WOnPmjEU5Z2dnPvvsM4YOHcqdO3d48skn8fLy4vbt2xw/fpzbt28zf/78PH1OnTp1okuXLkyYMIHY2FhatWplHi3VsGFDBg8enOWxL7zwAg4ODrRq1QpfX19u3rzJzJkz0ev1Odb45MbQoUP55JNP+N///sd7771H1apVWbduHRs2bABAo8nf74OBgYFMnz6dt956i0uXLtG1a1fKlSvHrVu3OHDgAE5OTkybNo1//vmHV155haeeeopq1aphZ2fH1q1b+eeffyxq+QYPHszkyZN
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plot\n",
"\n",
"# Reusable function to plot the data\n",
"def plot_denoise_results(beta, N, ax):\n",
" # Create the data\n",
" x = np.linspace(-1, 1, num=N+1)\n",
" g, y = sample_with_noise(x, p5)\n",
" s = smooth((x, y), beta)\n",
"\n",
" ax.set_title(f\"{beta=} and {N=}\")\n",
" ax.set_xlabel(\"x\")\n",
" ax.set_ylabel(\"y\")\n",
" ax.plot(x, y, \".\", label=\"raw data points\")\n",
" ax.plot(x, g, \"-\", label=\"original function\")\n",
" ax.plot(x, s, \"-\", label=\"denoised values\")\n",
" ax.legend()\n",
"\n",
"\n",
"N = 100\n",
"beta = 10\n",
"\n",
"fig, ax = plot.subplots()\n",
"fig.suptitle(f\"Data denoising results\")\n",
"\n",
"# Plot the data\n",
"plot_denoise_results(beta, N, ax)"
]
},
{
"cell_type": "markdown",
"id": "f2e5c860",
"metadata": {},
"source": [
"We notice that finding a point where $\\nabla f(s) = 0$ is the same as finding a point where $\\frac 1 \\beta \\nabla f(s) = \\nabla \\frac 1 \\beta f(s) = 0$. We can use this to our advantage, by defining $h(s) = \\frac 1 \\beta f(s)$ and finding the points where $\\nabla h(s) = 0$ instead. When $\\beta \\to \\infty$, we have:\n",
"$$\n",
"\\lim_{\\beta \\to \\inf} h _\\beta (s) =\n",
"\\lim_{\\beta \\to \\inf} \n",
" \\frac 1 {2\\beta} \\sum_{k=0}^n (y_k - s_k)^2\n",
" +\\frac 1 2 \\sum_{k=1}^n (s_k - s_{k - 1})^2\n",
" = \\frac 1 2 \\sum_{k=1}^n (s_k - s_{k - 1})^2\n",
"$$\n",
"\n",
"It now becomes trivial to verify that $\\nabla f(s) = As$, which means the solution to this will simply be the zero vector."
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "d7f7dbdf",
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABQsAAAPLCAYAAAD4+99NAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd3gU1dfA8e/spndIAoQSEnow9AAC0kQ6SFNCeaUI/kQUlA4qVaWDoAIqChFFQCEgCtKkg0BoShcwEEoghJLednfeP0JWlvSQZFPO53n2MTtzZ+bMsO7ZuXOLoqqqihBCCCGEEEIIIYQQotjTmDsAIYQQQgghhBBCCCFEwSCVhUIIIYQQQgghhBBCCEAqC4UQQgghhBBCCCGEEI9JZaEQ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HcvXvX2OIxMTGR7du3Z2mf6X2mMjtuenLyWczO/o8dO5aqJaqqqnzzzTf4+vpSs2bNDLd/0rx584wT6aRUFKacQ0BAAP379+fixYs8//zzBAYGkpiYSK9evXBwcKB69eqsX78+y8cSQgghRPEglYVCCCGESNfZs2eNY9GFhYVx4MABVq5ciVarZePGjbi7uwPQpUsXAgICqFGjBrVr1+bEiRPMmzeP8uXLp9pnStflxYsXM3DgQCwtLalevXq29pGWjz76iA4dOtC2bVvGjBmDXq9nzpw52Nvb8+DBA2O5xYsX88ILL9C8eXPeeustvLy8iIqK4sqVK/z666/s3r0729dp1qxZtG3bltatWzN
"text/plain": [
"<Figure size 1280x960 with 9 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig, axs = plot.subplots(\n",
" 3,\n",
" 3,\n",
" layout=\"constrained\",\n",
" figsize=(12.8, 9.6)\n",
")\n",
"\n",
"fig.suptitle(r\"Data denoising results as $\\beta \\to \\infty$\")\n",
"\n",
"N = 100\n",
"\n",
"for i in range(len(axs.flat)):\n",
" ax = axs.flat[i]\n",
" plot_denoise_results(4**i, N, ax)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "dfc485d5",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}