Skip to content

Commit

Permalink
Minor changes to tutorial notebooks
Browse files Browse the repository at this point in the history
Summary:
- added tutorial to list in `README.md`

- there were a few unused and duplicated imports.

- added backticks (``) around code and Python classes, variables, etc (as in `PearlAgent`)

- added a link to nbviewer at the top of the notebooks. Here, Ive added in the next diff:

> Here is a [better rendering](https://nbviewer.org/github/facebookresearch/Pearl/blob/main/tutorials/actor_critic_and_rc_safety_module/actor_critic_and_safe_actor_critic.ipynb) of this notebook on [nbviewer](https://nbviewer.org/).

- moved the title and description of the tutorial to the top.

Reviewed By: Yonathae

Differential Revision: D54573173

fbshipit-source-id: b33bf52977594f3ebfb59354f42c4b55a3e7d200
  • Loading branch information
rodrigodesalvobraz authored and facebook-github-bot committed Mar 6, 2024
1 parent 126eb2d commit c42a935
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 86 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ We provide a few tutorial Jupyter notebooks (and are currently working on more!)

4. [Deep Q-Learning (DQN) and Double DQN](https://nbviewer.org/github/facebookresearch/Pearl/blob/main/tutorials/sequential_decision_making/DQN_and_DoubleDQN_example.ipynb). Demonstrates how to run DQN and Double DQN on the Cart-Pole environment.

5. [Actor-critic algorithms with safety constraints](https://nbviewer.org/github/facebookresearch/Pearl/blob/main/tutorials/actor_critic_and_rc_safety_module/actor_critic_and_safe_actor_critic.ipynb). Demonstrates how to run Actor Critic methods, including a version with safe constraints.


## Design and Features
Expand Down

Large diffs are not rendered by default.

78 changes: 46 additions & 32 deletions tutorials/frozen_lake/frozen_lake.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"\n",
"Here is a [better rendering](https://nbviewer.org/github/facebookresearch/Pearl/blob/main/tutorials/frozen_lake/frozen_lake.ipynb) of this notebook on [nbviewer](https://nbviewer.org/).\n",
"\n",
"This example sho ws how to use DQN to solve the `FrozenLake-v1` environment from gymnasium. This environment has observations as indices (tabular observation)which is not suitable for learning with a neural network. In what follows, we show how to use Pearl's `OneHotObservationsFromDiscrete` wrapper to convert observations to their one-hot representations."
"This example shows how to use DQN to solve the `FrozenLake-v1` environment from gymnasium. This environment has observations as indices (tabular observation)which is not suitable for learning with a neural network. In what follows, we show how to use Pearl's `OneHotObservationsFromDiscrete` wrapper to convert observations to their one-hot representations."
]
},
{
Expand Down Expand Up @@ -1821,29 +1821,43 @@
"custom": {
"cells": [],
"metadata": {
"accelerator": "GPU",
"colab": {
"gpuType": "T4",
"include_colab_link": true,
"provenance": []
"custom": {
"cells": [],
"metadata": {
"accelerator": "GPU",
"colab": {
"gpuType": "T4",
"include_colab_link": true,
"provenance": []
},
"fileHeader": "",
"fileUid": "4316417e-7688-45f2-a94f-24148bfc425e",
"isAdHoc": false,
"kernelspec": {
"display_name": "pearl (local)",
"language": "python",
"name": "pearl_local"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2
},
"fileHeader": "",
"fileUid": "4316417e-7688-45f2-a94f-24148bfc425e",
"fileUid": "1158a851-91bb-437e-a391-aba92448f600",
"indentAmount": 2,
"isAdHoc": false,
"kernelspec": {
"display_name": "pearl (local)",
"language": "python",
"name": "pearl_local"
},
"language_info": {
"name": "python"
"name": "plaintext"
}
},
"nbformat": 4,
"nbformat_minor": 2
},
"fileHeader": "",
"fileUid": "1158a851-91bb-437e-a391-aba92448f600",
"fileUid": "ddf9fa29-09d7-404d-bc1b-62a580952524",
"indentAmount": 2,
"isAdHoc": false,
"language_info": {
Expand All @@ -1854,36 +1868,36 @@
"nbformat_minor": 2
},
"fileHeader": "",
"fileUid": "ddf9fa29-09d7-404d-bc1b-62a580952524",
"fileUid": "e751f6fa-be9e-4f88-9fef-36812551b013",
"indentAmount": 2,
"isAdHoc": false,
"kernelspec": {
"display_name": "pearl2",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "plaintext"
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.18"
}
},
"nbformat": 4,
"nbformat_minor": 2
},
"fileHeader": "",
"fileUid": "e751f6fa-be9e-4f88-9fef-36812551b013",
"fileUid": "a6d73a55-c990-483c-9ad3-c926ad0c935a",
"indentAmount": 2,
"isAdHoc": false,
"kernelspec": {
"display_name": "pearl2",
"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.8.18"
"name": "plaintext"
}
},
"nbformat": 4,
Expand Down

0 comments on commit c42a935

Please sign in to comment.