This commit is contained in:
Thomas (Tom) C. Gorordo 2025-12-20 08:08:47 -08:00
parent 6cdc579270
commit cbedbbeb48
12 changed files with 1582 additions and 591 deletions

View file

@ -1,18 +1,22 @@
import marimo
__generated_with = "0.13.6"
__generated_with = "0.18.3"
app = marimo.App(width="medium")
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""# Caltech Hovse Rotation Example""")
mo.md(r"""
# Caltech Hovse Rotation Example
""")
return
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""## Imports""")
mo.md(r"""
## Imports
""")
return
@ -22,27 +26,73 @@ def _():
import polars as pl, polars.selectors as pls
import numpy as np, faker as fk
import carousel as crsl
return crsl, mo, pl
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""## Generating Rotation Rankings""")
mo.md(r"""
## Generating Rotation Rankings
""")
return
@app.cell
def _(crsl, pl):
ar = pl.DataFrame({ "": ["A", "B", "C", "D"], "a": [1, 2, 3, 4], "b": [1, 4, 3, 2], "c": [2, 1, 3, 4], "d": [4, 2, 3, 1]})
rr = pl.DataFrame({ "": ["a", "b", "c", "d"], "A": [3, 4, 2, 1], "B": [3, 1, 4, 2], "C": [2, 3, 4, 1], "D": [3, 2, 1, 4]})
ar = pl.DataFrame(
{
"": ["A", "B", "C", "D"],
"a": [1, 2, 3, 4],
"b": [1, 4, 3, 2],
"c": [2, 1, 3, 4],
"d": [4, 2, 3, 1],
}
)
rr = pl.DataFrame(
{
"": ["a", "b", "c", "d"],
"A": [3, 4, 2, 1],
"B": [3, 1, 4, 2],
"C": [2, 3, 4, 1],
"D": [3, 2, 1, 4],
}
)
m = pl.DataFrame({"A": ["c"], "B": ["d"], "C": ["a"], "D": ["b"]})
crsl.check_stable(m, ar, rr)
crsl.check_match_stable(m, ar, rr)
return ar, rr
@app.cell
def _(ar):
ar
return
@app.cell
def _():
hovses = ["Blacker", "Dabney", "Ricketts", "Fleming", "Page", "Lloyd", "Venerable", "Avery"]
hovses = [
"Blacker",
"Dabney",
"Ricketts",
"Fleming",
"Page",
"Lloyd",
"Venerable",
"Avery",
]
return
@app.cell
def _(ar, crsl):
crsl.rank_to_pref(ar)
return
@app.cell
def _(crsl, rr):
crsl.pref_to_prio(crsl.rank_to_pref(rr))
return