Whitespace changes.
This commit is contained in:
parent
868cc84155
commit
35f473602f
@ -859,7 +859,7 @@
|
||||
"weights = [158.0, 164.2, 160.3, 159.9, 162.1, 164.6, \n",
|
||||
" 169.6, 167.4, 166.4, 171.0, 171.2, 172.6]\n",
|
||||
"\n",
|
||||
"time_step = 1.0 # day\n",
|
||||
"time_step = 1.0 # day\n",
|
||||
"scale_factor = 4.0/10\n",
|
||||
"\n",
|
||||
"def predict_using_gain_guess(weight, gain_rate, do_print=True, sim_rate=0): \n",
|
||||
@ -885,6 +885,7 @@
|
||||
"\n",
|
||||
" # plot results\n",
|
||||
" gh.plot_gh_results(weights, estimates, predictions, sim_rate)\n",
|
||||
"\n",
|
||||
"initial_guess = 160.\n",
|
||||
"predict_using_gain_guess(weight=initial_guess, gain_rate=1) "
|
||||
]
|
||||
@ -2515,7 +2516,7 @@
|
||||
"import time\n",
|
||||
"\n",
|
||||
"with interactive_plot():\n",
|
||||
" for x in range(2,6):\n",
|
||||
" for x in range(2, 6):\n",
|
||||
" plt.plot([0, 1], [1, x])\n",
|
||||
" plt.gcf().canvas.draw()\n",
|
||||
" time.sleep(0.5)"
|
||||
@ -3357,7 +3358,7 @@
|
||||
],
|
||||
"source": [
|
||||
"weight = 160. # initial guess\n",
|
||||
"gain_rate = -1.0 # initial guess\n",
|
||||
"gain_rate = -1.0 # initial guess\n",
|
||||
"\n",
|
||||
"time_step = 1.\n",
|
||||
"weight_scale = 4./10\n",
|
||||
@ -4005,15 +4006,15 @@
|
||||
" x_est = x0\n",
|
||||
" results = []\n",
|
||||
" for z in data:\n",
|
||||
" #prediction step\n",
|
||||
" # prediction step\n",
|
||||
" x_pred = x_est + (dx*dt)\n",
|
||||
" dx = dx\n",
|
||||
"\n",
|
||||
" # update step\n",
|
||||
" residual = z - x_pred\n",
|
||||
" dx = dx + h * (residual) / dt\n",
|
||||
" x_est = x_pred + g * residual \n",
|
||||
" results.append(x_est) \n",
|
||||
" dx = dx + h * (residual) / dt\n",
|
||||
" x_est = x_pred + g * residual\n",
|
||||
" results.append(x_est)\n",
|
||||
" return np.array(results)\n",
|
||||
"\n",
|
||||
"book_plots.plot_track([0, 11], [160, 172], label='Actual weight')\n",
|
||||
@ -4402,7 +4403,7 @@
|
||||
" book_plots.plot_filter(data2, label='g=0.4', marker='v')\n",
|
||||
" book_plots.plot_filter(data3, label='g=0.8', lw=2)\n",
|
||||
" plt.legend(loc=4)\n",
|
||||
" book_plots.set_limits([20,40], [50, 250])"
|
||||
" book_plots.set_limits([20, 40], [50, 250])"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user