Skip to content

Commit

Permalink
Adjust pes_error_scale in control example
Browse files Browse the repository at this point in the history
  • Loading branch information
drasmuss authored and hunse committed Jan 14, 2019
1 parent 59ca67d commit 673bd67
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions docs/examples/adaptive_motor_control.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,9 @@
"source": [
"## Running the network with Nengo Loihi\n",
"\n",
"Loihi has some implicit gains included in it\n",
"so we use a learning rate of 1e-6 in Nengo Loihi,\n",
"instead of 1e-5, to match the performance of the standard Nengo backend."
"Loihi has limits on the magnitude of the \n",
"error signal, so we need to adjust the\n",
"`pes_error_scale` parameter to avoid too much overflow."
]
},
{
Expand All @@ -438,10 +438,12 @@
"metadata": {},
"outputs": [],
"source": [
"adapt_loihi_model = add_adaptation(\n",
" add_gravity(build_baseline_model()), learning_rate=1e-6)\n",
"arm_sim.reset()\n",
"with nengo_loihi.Simulator(adapt_loihi_model) as sim:\n",
"\n",
"model = nengo_loihi.builder.Model()\n",
"model.pes_error_scale = 10\n",
"\n",
"with nengo_loihi.Simulator(adapt_model, model=model) as sim:\n",
" sim.run(runtime)\n",
"adapt_loihi_t = sim.trange()\n",
"adapt_loihi_data = sim.data"
Expand All @@ -453,10 +455,10 @@
"metadata": {},
"outputs": [],
"source": [
"adapt_loihi_error = calculate_error(adapt_loihi_model, adapt_loihi_data)\n",
"adapt_loihi_error = calculate_error(adapt_model, adapt_loihi_data)\n",
"plot_xy(\n",
" [adapt_loihi_t],\n",
" [adapt_loihi_data[adapt_loihi_model.probe_hand]],\n",
" [adapt_loihi_data[adapt_model.probe_hand]],\n",
" ['Adapt'])\n",
"plot_data(\n",
" [baseline_t, gravity_t, adapt_t, adapt_loihi_t],\n",
Expand Down

0 comments on commit 673bd67

Please sign in to comment.