Skip to content

Commit

Permalink
Add more description and show W matrix in DMDc section
Browse files Browse the repository at this point in the history
  • Loading branch information
AnesBenmerzoug committed May 8, 2024
1 parent c74b6a2 commit 54f865e
Showing 1 changed file with 190 additions and 8 deletions.
198 changes: 190 additions & 8 deletions notebooks/nb_70_machine_learning_control.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "8497a4b2-a020-4fba-8539-bc1361a34023",
"metadata": {
"editable": true,
Expand All @@ -28,7 +28,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "f7339d3d-eae4-4e05-a7fb-050df96782e7",
"metadata": {
"init_cell": true,
Expand All @@ -41,14 +41,184 @@
"ActiveScene"
]
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<style>/*\n",
"This file is mainly copy-pasta from rise's examples\n",
"https://github.com/damianavila/RISE/blob/master/examples/rise.css\n",
"that was further customized for appliedAI purposes\n",
"*/\n",
"@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@400&display=swap');\n",
"\n",
"\n",
"/*\n",
"body {\n",
" font-family: 'Work Sans', sans-serif !important;\n",
" text-transform: initial !important;\n",
" letter-spacing: initial !important;\n",
" font-weight: 400 !important;\n",
" line-height: 1.5 !important;\n",
" text-size-adjust: 100% !important;\n",
" ‑webkit‑text‑size‑adjust: 100% !important;\n",
"}\n",
"\n",
"\n",
".reveal, div.text_cell_render, .md-slide, .sidebar-wrapper {\n",
" font-size: 1.5rem !important;\n",
"}\n",
"*/\n",
"\n",
".navbar-default .navbar-nav > li > a {\n",
" color: #00747b !important;\n",
"}\n",
"\n",
".filename {\n",
" font-size: 2.4rem !important;\n",
" color: #212529 !important;\n",
" font-weight: 600 !important;\n",
"}\n",
"\n",
".reveal, .md-slide {\n",
" color: white !important;\n",
"}\n",
"\n",
"h1, h2 {\n",
" color: #00747b !important;\n",
"}\n",
"\n",
"h3, h4, h5, h6 {\n",
" color: #808080 !important;\n",
"}\n",
"\n",
".reveal p, .reveal ol, .reveal dl, .reveal ul,\n",
"div.text_cell_render {\n",
" color: #212529 !important;\n",
"}\n",
"\n",
"/*copied from stackoverflow, better spacing between list items*/\n",
"li + li {\n",
" margin-top: 0.2em;\n",
"}\n",
"\n",
"body.rise-enabled .reveal ol, body.rise-enabled .reveal dl, body.rise-enabled .reveal ul {\n",
" margin-left: 0.1em;\n",
" margin-top: 0.2em;\n",
"}\n",
"\n",
".reveal .rendered_html h1:first-child,\n",
".reveal .rendered_html h2:first-child,\n",
".reveal .rendered_html h3:first-child,\n",
".reveal .rendered_html h4:first-child,\n",
".reveal .rendered_html h5:first-child {\n",
" margin-top: 0.2em;\n",
"}\n",
"\n",
"/*\n",
".CodeMirror-lines, .output_text {\n",
" font-size: 1.5rem !important;\n",
"}\n",
"*/\n",
"\n",
"h1.plan, h2.plan, h3.plan {\n",
" text-align: center;\n",
" padding-bottom: 30px;\n",
"}\n",
"\n",
"ul.plan>li>span.plan-bold {\n",
" font-size: 110%;\n",
" padding: 4px;\n",
" font-weight: bold;\n",
" background-color: #eee;\n",
"}\n",
"\n",
"ul.plan>li>ul.subplan>li>span.plan-bold {\n",
" font-weight: bold;\n",
"}\n",
"\n",
".plan-strike {\n",
" opacity: 0.4;\n",
"/* text-decoration: line-through; */\n",
"}\n",
"\n",
"div.plan-container {\n",
" display: grid;\n",
" grid-template-columns: 50% 50%;\n",
"}\n",
"\n",
"/*\n",
" * this is to void xarray's html output to show the fallback textual representation\n",
" * see also\n",
" * xarray.md and\n",
" * https://github.com/damianavila/RISE/issues/594\n",
" */\n",
".reveal pre.xr-text-repr-fallback {\n",
" display: none;\n",
"}\n",
"\n",
"#toc-header, .toc-item li {\n",
" margin: auto !important;\n",
" color: #808080 !important;\n",
"}\n",
"\n",
"#toc, #toc-wrapper, .toc-item-num, #toc a, .toc {\n",
" margin: auto !important;\n",
" color: #00747b !important;\n",
"}\n",
"\n",
"#toc-wrapper {\n",
" top: auto !important;\n",
" bottom: auto !important;\n",
" margin-top: 2rem !important;\n",
" color: #00747b !important;\n",
"}\n",
"\n",
"\n",
"#rise-header {\n",
" margin: 10px;\n",
" left: 5%;\n",
"}\n",
"\n",
"#rise-footer {\n",
" margin: 10px;\n",
" right: 5%;\n",
"}\n",
"\n",
"#rise-backimage {\n",
" opacity: 0.70;\n",
"}\n",
"\n",
".reveal img {\n",
" max-width: 100%;\n",
"}\n",
"\n",
"\n",
".md-slide.title {\n",
" position: relative;\n",
" top: -50%;\n",
" margin-left: 5%;\n",
" font-size: 4em !important;\n",
" line-height: 1.6;\n",
"}\n",
"</style>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%presentation_style"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "6e892149-098a-42c7-b554-bbb83918888d",
"metadata": {
"init_cell": true,
Expand All @@ -66,7 +236,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "cd78d373-34af-4b57-8d16-dbf6f662331d",
"metadata": {
"init_cell": true,
Expand All @@ -79,7 +249,16 @@
"ActiveScene"
]
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"pygame 2.5.2 (SDL 2.28.2, Python 3.10.12)\n",
"Hello from the pygame community. https://www.pygame.org/contribute.html\n"
]
}
],
"source": [
"%autoreload\n",
"import warnings\n",
Expand Down Expand Up @@ -684,7 +863,9 @@
"id": "e2ec06ac-e9e8-4918-9ea8-8107a16f7104",
"metadata": {},
"source": [
"#### Cart "
"#### Cart\n",
"\n",
"We will use the DMDc method to fit a model on the data collected from the Cart environment. For that we will make sure of the [pykoopman](https://pykoopman.readthedocs.io/en/master/index.html) package."
]
},
{
Expand Down Expand Up @@ -727,7 +908,8 @@
"source": [
"display_array(\"A\", model.A)\n",
"display_array(\"B\", model.B)\n",
"display_array(\"C\", model.C)"
"display_array(\"C\", model.C)\n",
"display_array(\"W\", model.W)"
]
},
{
Expand Down

0 comments on commit 54f865e

Please sign in to comment.