Akshay Agrawal commited on
Commit
8646a4e
·
1 Parent(s): b16b20d

optimization: move import marimo as mo to top of notebook

Browse files

On some browsers (firefox) the marimo playground is very slow to start/autorun.
Users then start manually running cells from top to bottom, resulting
in "mo not defined" if import marimo as mo is not at the top of the
notebook.

optimization/01_least_squares.py CHANGED
@@ -13,6 +13,12 @@ __generated_with = "0.11.0"
13
  app = marimo.App()
14
 
15
 
 
 
 
 
 
 
16
  @app.cell(hide_code=True)
17
  def _(mo):
18
  mo.md(
@@ -113,11 +119,5 @@ def _(mo):
113
  return
114
 
115
 
116
- @app.cell
117
- def _():
118
- import marimo as mo
119
- return (mo,)
120
-
121
-
122
  if __name__ == "__main__":
123
  app.run()
 
13
  app = marimo.App()
14
 
15
 
16
+ @app.cell
17
+ def _():
18
+ import marimo as mo
19
+ return (mo,)
20
+
21
+
22
  @app.cell(hide_code=True)
23
  def _(mo):
24
  mo.md(
 
119
  return
120
 
121
 
 
 
 
 
 
 
122
  if __name__ == "__main__":
123
  app.run()
optimization/02_linear_program.py CHANGED
@@ -15,6 +15,12 @@ __generated_with = "0.11.0"
15
  app = marimo.App()
16
 
17
 
 
 
 
 
 
 
18
  @app.cell(hide_code=True)
19
  def _(mo):
20
  mo.md(
@@ -259,11 +265,5 @@ def _(mo, prob, x):
259
  return
260
 
261
 
262
- @app.cell
263
- def _():
264
- import marimo as mo
265
- return (mo,)
266
-
267
-
268
  if __name__ == "__main__":
269
  app.run()
 
15
  app = marimo.App()
16
 
17
 
18
+ @app.cell
19
+ def _():
20
+ import marimo as mo
21
+ return (mo,)
22
+
23
+
24
  @app.cell(hide_code=True)
25
  def _(mo):
26
  mo.md(
 
265
  return
266
 
267
 
 
 
 
 
 
 
268
  if __name__ == "__main__":
269
  app.run()
optimization/04_quadratic_program.py CHANGED
@@ -15,6 +15,12 @@ __generated_with = "0.11.0"
15
  app = marimo.App()
16
 
17
 
 
 
 
 
 
 
18
  @app.cell(hide_code=True)
19
  def _(mo):
20
  mo.md(
@@ -255,11 +261,5 @@ def _(np):
255
  return (plot_contours,)
256
 
257
 
258
- @app.cell
259
- def _():
260
- import marimo as mo
261
- return (mo,)
262
-
263
-
264
  if __name__ == "__main__":
265
  app.run()
 
15
  app = marimo.App()
16
 
17
 
18
+ @app.cell
19
+ def _():
20
+ import marimo as mo
21
+ return (mo,)
22
+
23
+
24
  @app.cell(hide_code=True)
25
  def _(mo):
26
  mo.md(
 
261
  return (plot_contours,)
262
 
263
 
 
 
 
 
 
 
264
  if __name__ == "__main__":
265
  app.run()
optimization/05_portfolio_optimization.py CHANGED
@@ -16,6 +16,12 @@ __generated_with = "0.11.2"
16
  app = marimo.App()
17
 
18
 
 
 
 
 
 
 
19
  @app.cell(hide_code=True)
20
  def _(mo):
21
  mo.md(r"""# Portfolio optimization""")
@@ -247,11 +253,5 @@ def _(gamma, gamma_vals, markers_on, np, plt, prob, ret, risk):
247
  return midx, spstats, x
248
 
249
 
250
- @app.cell
251
- def _():
252
- import marimo as mo
253
- return (mo,)
254
-
255
-
256
  if __name__ == "__main__":
257
  app.run()
 
16
  app = marimo.App()
17
 
18
 
19
+ @app.cell
20
+ def _():
21
+ import marimo as mo
22
+ return (mo,)
23
+
24
+
25
  @app.cell(hide_code=True)
26
  def _(mo):
27
  mo.md(r"""# Portfolio optimization""")
 
253
  return midx, spstats, x
254
 
255
 
 
 
 
 
 
 
256
  if __name__ == "__main__":
257
  app.run()
optimization/06_convex_optimization.py CHANGED
@@ -13,6 +13,12 @@ __generated_with = "0.11.2"
13
  app = marimo.App()
14
 
15
 
 
 
 
 
 
 
16
  @app.cell(hide_code=True)
17
  def _(mo):
18
  mo.md(
@@ -80,11 +86,5 @@ def _(x):
80
  return
81
 
82
 
83
- @app.cell
84
- def _():
85
- import marimo as mo
86
- return (mo,)
87
-
88
-
89
  if __name__ == "__main__":
90
  app.run()
 
13
  app = marimo.App()
14
 
15
 
16
+ @app.cell
17
+ def _():
18
+ import marimo as mo
19
+ return (mo,)
20
+
21
+
22
  @app.cell(hide_code=True)
23
  def _(mo):
24
  mo.md(
 
86
  return
87
 
88
 
 
 
 
 
 
 
89
  if __name__ == "__main__":
90
  app.run()
optimization/07_sdp.py CHANGED
@@ -14,6 +14,12 @@ __generated_with = "0.11.2"
14
  app = marimo.App()
15
 
16
 
 
 
 
 
 
 
17
  @app.cell(hide_code=True)
18
  def _(mo):
19
  mo.md(r"""# Semidefinite program""")
@@ -118,11 +124,5 @@ def _():
118
  return (wigglystuff,)
119
 
120
 
121
- @app.cell
122
- def _():
123
- import marimo as mo
124
- return (mo,)
125
-
126
-
127
  if __name__ == "__main__":
128
  app.run()
 
14
  app = marimo.App()
15
 
16
 
17
+ @app.cell
18
+ def _():
19
+ import marimo as mo
20
+ return (mo,)
21
+
22
+
23
  @app.cell(hide_code=True)
24
  def _(mo):
25
  mo.md(r"""# Semidefinite program""")
 
124
  return (wigglystuff,)
125
 
126
 
 
 
 
 
 
 
127
  if __name__ == "__main__":
128
  app.run()