Skip to content

Commit

Permalink
doc: update examples and add tfds example
Browse files Browse the repository at this point in the history
  • Loading branch information
BillHuang2001 committed Apr 24, 2024
1 parent 31f58b6 commit 240d50d
Show file tree
Hide file tree
Showing 6 changed files with 48,554 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/source/example/atari_pong.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"outputs": [],
"source": [
"from evox import workflows, algorithms, problems\n",
"from evox.monitors import StdSOMonitor\n",
"from evox.monitors import EvalMonitor\n",
"from evox.utils import TreeAndVector\n",
"import jax\n",
"import jax.numpy as jnp\n",
Expand Down Expand Up @@ -78,7 +78,7 @@
"model = PongPolicy()\n",
"params = model.init(model_key, jnp.zeros((210, 160, 3)))\n",
"adapter = TreeAndVector(params)\n",
"monitor = StdSOMonitor()\n",
"monitor = EvalMonitor()\n",
"problem = problems.neuroevolution.Gym(\n",
" env_name=\"ALE/Pong-v5\",\n",
" env_options={\"full_action_space\": False},\n",
Expand Down
3 changes: 1 addition & 2 deletions docs/source/example/custom_algorithm_and_problem.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
" flip_prob=0.1,\n",
")\n",
"problem = OneMax()\n",
"monitor = monitors.StdSOMonitor()"
"monitor = monitors.EvalMonitor()"
]
},
{
Expand All @@ -137,7 +137,6 @@
" algorithm,\n",
" problem,\n",
" monitors=[monitor],\n",
" record_pop=True,\n",
" opt_direction=\"max\",\n",
")"
]
Expand Down
4 changes: 2 additions & 2 deletions docs/source/example/gym_classic_control.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"outputs": [],
"source": [
"from evox import workflows, algorithms, problems\n",
"from evox.monitors import StdSOMonitor\n",
"from evox.monitors import EvalMonitor\n",
"from evox.utils import TreeAndVector\n",
"import jax\n",
"import jax.numpy as jnp\n",
Expand Down Expand Up @@ -97,7 +97,7 @@
"model = ClassicPolicy()\n",
"params = model.init(model_key, jnp.zeros(policy_params[gym_name][1]))\n",
"adapter = TreeAndVector(params)\n",
"monitor = StdSOMonitor()\n",
"monitor = EvalMonitor()\n",
"problem = problems.neuroevolution.Gym(\n",
" env_name=gym_name,\n",
" policy=jax.jit(model.apply),\n",
Expand Down
1 change: 1 addition & 0 deletions docs/source/example/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ pso_ackley
custom_algorithm_and_problem
gym_classic_control
atari_pong
tfds
```
3 changes: 1 addition & 2 deletions docs/source/example/pso_ackley.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
" pop_size=100,\n",
")\n",
"problem = problems.numerical.Ackley()\n",
"monitor = monitors.StdSOMonitor()"
"monitor = monitors.EvalMonitor()"
]
},
{
Expand All @@ -60,7 +60,6 @@
" algorithm,\n",
" problem,\n",
" monitors=[monitor],\n",
" record_pop=True,\n",
")"
]
},
Expand Down
48,547 changes: 48,547 additions & 0 deletions docs/source/example/tfds.ipynb

Large diffs are not rendered by default.

0 comments on commit 240d50d

Please sign in to comment.