" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 課題解答例\n", "\n", "## Gaussian(正規分布)へのフィット\n", "\n", "正規分布で知られる，ガウス関数\n", "$$\n", "f(x)= \\frac{1}{\\sqrt{2\\pi\\sigma}}\n", "\\exp \\left(\\frac{- (x-\\mu)^2}{2\\sigma^2} \\right)\n", "$$\n", "フィットをやってみましょう．\n", "\n", "例えば，平均値($\\mu$)が60点，偏差値($\\sigma$)が15点として，ピークの人数が20人としましょう．" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAD8CAYAAABw1c+bAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4VPXZ//H3PVkhQFgSMKxhiSEJu2GVIqICgksrWsHdqlTFrZtibftof/XRat21RSu2LtQVrRubUhGtoAl7ICyBsIQtYUuAELLdvz9m8IkxkZCZyZnlfl3XXMw5c+bM56vhw+Q7Z84RVcUYY0z4cDkdwBhjTNOy4jfGmDBjxW+MMWHGit8YY8KMFb8xxoQZK35jjAkzVvzGGBNmrPiNMSbMWPEbY0yYiXQ6QF0SEhI0OTnZ6RjGGBM0li1btk9VExuybUAWf3JyMtnZ2U7HMMaYoCEi2xq6rU31GGNMmLHiN8aYMGPFb4wxYcaK3xhjwowVvzHGhJmTFr+IdBGRz0RknYisFZE7PevbisgnIrLJ82ebep4/XkQ2iEieiEz39QCMMcacmoa8468EfqWq6cAwYJqIpAPTgYWqmgIs9Cx/h4hEAM8B5wPpwBTPc40xxjjkpMWvqrtVdbnn/mEgF+gEXAy87NnsZeDHdTx9CJCnqltUtRx4w/M8Y8xJHNx8gK/ueIPPL32GvA/WodV2mVTjG6f0BS4RSQYGAl8DHVR1t+ehPUCHOp7SCdhRY7kAGFrPvqcCUwG6du16KrGMCSlLfvk2Lf7+OOlHvmEE1e6Vs6Egoht5Ay5l6IL/R7O2zZwNaYJagz/c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TiDufgbfCH3UCAiUbhLf5aqvutZvVdEkjyPJwGFTuXzgzOBi0RkK+5pvDEi8hqhPWZwv6srUNWvPcvv4P6HIJTHfS6Qr6pFqloBvAuMILTHXFN94/RbxwVz8TfkYu8hQUQE95xvrqo+XuOhD4BrPfevBd5v6mz+oqr3qmpnVU3G/f/2P6p6FSE8ZgBV3QPsEJFUz6pzgHWE9ri3A8NEpLnnZ/0c3J9jhfKYa6pvnB8Ak0UkRkS6AynANz55RVUN2hvuC7lvBDYD9zmdx4/jHIn717/VwErPbQLQDvdRAJuAT4G2Tmf10/hHAx957of8mIEBQLbn//e/gTahPm7gAWA9kAO8CsSE4piB13F/jlGB+7e7G35onMB9nn7bAJzvqxz2zV1jjAkzwTzVY4wxphGs+I0xJsxY8RtjTJix4jfGmDBjxW+MMWHGit8YY8KMFb8xxoQZK35jjAkz/x+8gnCHEzihyAAAAABJRU5ErkJggg==\n", "text/plain": [ "" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", "def func(x, a1, a2, a3):\n", " return a1*np.exp(-(x-a2)**2/a3**2)\n", "\n", "ndata = 100\n", "xdata = np.linspace(1, ndata, ndata)\n", "y = func(xdata, 20, 60, 15)\n", "ydata = y\n", "plt.plot(xdata, ydata, 'b-', label='data')\n", "\n", "popt, pcov = curve_fit(func, xdata, ydata)\n", "plt.plot(xdata, func(xdata, *popt), 'r-', label='fit')\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [], "source": [ "from pprint import pprint\n", "import scipy.linalg as linalg\n", "\n", "def dfda1(x,a1,a2,a3):\n", " return np.exp(-(x - a2) ** 2 / a3 ** 2 / 2)\n", "def dfda2(x,a1,a2,a3):\n", " return a1 * (x - a2) / a3 ** 2 * np.exp(-(x - a2) ** 2 / a3 ** 2 / 2)\n", "def dfda3(x,a1,a2,a3):\n", " return a1 * (x - a2) ** 2 / a3 ** 3 * np.exp(-(x - a2) ** 2 / a3 ** 2 / 2)" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "nparam = 3\n", "guess1 = [10,50,10]" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "array([ 19.866, 59.841, 14.878])\n" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAD8CAYAAABw1c+bAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xd4VHX6/vH3k0oSOgkdDSgCQRAlgihFkYRQpOki4CoqLuqqq65+d3WLq7u6u+66doVFRVEUC6L0Joq9EJASSugdQiBAIL08vz9m2F+MCYTMJGfK87quXJlz5syc+6N4O3zmFFFVjDHGBI8QpwMYY4ypXVb8xhgTZKz4jTEmyFjxG2NMkLHiN8aYIGPFb4wxQcaK3xhjgowVvzHGBBkrfmOMCTJhTgeoSGxsrMbHxzsdwxhj/MbKlSsPq2pcVbb1yeKPj48nNTXV6RjGGOM3RGRXVbe1qR5jjAkyVvzGGBNkrPiNMSbIWPEbY0yQseI3xpggc8biF5E2IvKZiGwQkfUicq97fWMRWSoiW9y/G1Xy+hQRSReRrSLykLcHYIwx5uxU5RN/MfCAqiYAlwF3iUgC8BCwTFXbA8vcyz8hIqHAS8AgIAEY636tMcYYh5yx+FX1gKqucj8+AWwEWgHDgWnuzaYBIyp4eQ9gq6puV9VC4F3364wxZ5CVBe++Cy+8ABs2gN0l1XjLWc3xi0g8cDHwPdBMVQ+4nzoINKvgJa2APWWW97rXVfTeE0UkVURSMzMzzyaWMQHlgw+gVy+Ii4OJY7N57DeH6dwZ2raFBx+EvDynExp/V+XiF5G6wIfAfaqaXfY5dd2x3aPPI6o6RVUTVTUxLq5KZx0bE1BU4ZFH4JXRS/jzhrFkNOpANg3IDGnG7oQU7op7jxf/k0///pCR4XRa48+qVPwiEo6r9N9W1Vnu1Rki0sL9fAv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fcxtgUzgdfcU16siEkMAj1tV9wFPAbuBA7ju1LeEAB5zOZWNs8Y6zp+LP+iISF3gQ+A+Vc0u+5z7pjcBc4iWiAwFDqnqysq2CbQxu4UBlwCTVPViIIdyUxyBNm73nPZwXP/TawnEiMgvy24TaGOuTG2N05+Lv8o3cg8EIhKOq/TfVtVZ7tUZItLC/XwL4JBT+WrAFcAwEdmJaxqvv4hMJ7DHDK5PdXtV9Xv38kxc/yMI5HEPAHaoaqaqFgGzgMsJ7DGXVdk4a6zj/Ln4q3Kz94AgIoJrznejqj5d5qk5wHj34/HA7NrOVlNU9WFVba2q8bj+3X6qqr8kgMcMoKoHgT0i0sG96mpgA4E97t3AZSIS7f6zfjWu77ECecxlVTbOOcAYEYkUkbZAe+AHr+xRVf32B9eN3DcD24A/Op2nBsfZG9df/9YCq90/g4EmuI4C2AJ8AjR2OmsNjf9KYJ77ccCPGegGpLr/fX8MNAr0cQOPAZuANOAtIDIQxwzMwPU9RhGuv91NON04gT+6+y0dGOStHHbmrjHGBBl/nuoxxhhTDVb8xhgTZKz4jTEmyFjxG2NMkLHiN8aYIGPFb4wxQcaK3xhjgowVvzHGBJn/B5Xzx84CkY4PAAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "df=np.zeros([ndata])\n", "for i in range(0,ndata):\n", " dy = ydata[i]-func(xdata[i], *guess1)\n", " df[i]=dy\n", "#pprint(df)\n", "Jac=np.zeros([ndata,nparam])\n", "for i in range(0,ndata):\n", " Jac[i,0] = dfda1(xdata[i], *guess1)\n", " Jac[i,1] = dfda2(xdata[i], *guess1)\n", " Jac[i,2] = dfda3(xdata[i], *guess1)\n", "# pprint(Jac)\n", "iJac = linalg.inv(np.dot(np.transpose(Jac),Jac))\n", "# print(iJac)\n", "Jdf = np.dot(np.transpose(Jac),df)\n", "# pprint(Jdf)\n", "guess1 = guess1 + np.dot(iJac, Jdf)\n", "pprint(guess1)\n", "plt.plot(xdata, ydata, 'b-', label='data')\n", "\n", "popt, pcov = curve_fit(func, xdata, ydata)\n", "plt.plot(xdata, func(xdata, *guess1), 'r-', label='fit')\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "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.6.1" }, "latex_envs": { "LaTeX_envs_menu_present": true, "autocomplete": true, "bibliofile": "biblio.bib", "cite_by": "apalike", "current_citInitial": 1, "eqLabelWithNumbers": true, "eqNumInitial": 1, "hotkeys": { "equation": "Ctrl-E", "itemize": "Ctrl-I" }, "labels_anchors": false, "latex_user_defs": false, "report_style_numbering": false, "user_envs_cfg": false }, "toc": { "colors": { "hover_highlight": "#DAA520", "navigate_num": "#000000", "navigate_text": "#333333", "running_highlight": "#FF0000", "selected_highlight": "#FFD700", "sidebar_border": "#EEEEEE", "wrapper_background": "#FFFFFF" }, "moveMenuLeft": true, "nav_menu": { "height": "12px", "width": "252px" }, "navigate_menu": true, "number_sections": true, "sideBar": true, "threshold": 4, "toc_cell": true, "toc_section_display": "block", "toc_window_display": true, "widenNotebook": false } }, "nbformat": 4, "nbformat_minor": 2 }