mirror of
https://github.com/saymrwulf/autoresearch-quantum.git
synced 2026-07-13 17:56:45 +00:00
- 8 Jupyter notebooks across 3 learning plans (A: bottom-up, B: spiral, C: parallel tracks)
- Teaching toolkit (src/autoresearch_quantum/teaching/) with ipywidgets-based
quiz, predict_choice, reflect, and order widgets — visually distinct from code cells
- Fix spectator_z operator: was {1:'Z',2:'Z'} (IZZI, expectation=0), now {1:'Z',3:'Z'}
(ZIZI, expectation=+1 for ideal T-state, commutes with logical operators)
- Fix u_magic seed: swap phase arguments to match h_p and ry_rz preparations
- Fix double-display bug: widgets rendered twice when function returned the box
- Fix CLI override parser for negative integers and missing '=' validation
- Fix stabilizer detection quiz: ZZZZ detects X errors, not Z errors
- Add ties parameter to order() for questions with interchangeable items
- Expand test suite from 21 to 107 tests
- Update README with notebook instructions and project tree
64 lines
2.8 KiB
Python
64 lines
2.8 KiB
Python
"""Widget-based teaching cells for Plan C — Dashboard."""
|
|
import json
|
|
from pathlib import Path
|
|
|
|
NB_PATH = Path("notebooks/plan_c/00_dashboard.ipynb")
|
|
nb = json.loads(NB_PATH.read_text())
|
|
ORIG = len(nb["cells"])
|
|
|
|
def md(s):
|
|
lines = s.strip().split("\n")
|
|
return {"cell_type": "markdown", "metadata": {}, "source": [l + "\n" for l in lines[:-1]] + [lines[-1]]}
|
|
def code(s):
|
|
lines = s.strip().split("\n")
|
|
return {"cell_type": "code", "metadata": {}, "source": [l + "\n" for l in lines[:-1]] + [lines[-1]], "outputs": [], "execution_count": None}
|
|
|
|
ins = []
|
|
|
|
ins.append((1, [code("""from autoresearch_quantum.teaching import LearningTracker
|
|
from autoresearch_quantum.teaching.assess import quiz, predict_choice, reflect, checkpoint_summary
|
|
tracker = LearningTracker("plan_c_dashboard")
|
|
print("Learning tracker active.")""")]))
|
|
|
|
ins.append((3, [
|
|
code("""quiz(tracker, "q1_baseline",
|
|
question="Why does the dashboard start from a rung-1 config as baseline?",
|
|
options=[
|
|
"It is the only config that exists",
|
|
"It provides sensible defaults that widgets then override one at a time",
|
|
"Higher rungs require IBM hardware access",
|
|
],
|
|
correct=1, section="1. Setup", bloom="understand",
|
|
explanation="The rung-1 config defines the full parameter space and bootstrap incumbent. Widgets let you explore variations.")"""),
|
|
]))
|
|
|
|
ins.append((5, [
|
|
code("""predict_choice(tracker, "q2_verification_effect",
|
|
question="What happens to acceptance rate if you set verification to 'none'?",
|
|
options=[
|
|
"Acceptance rate drops because there are no checks",
|
|
"Acceptance rate goes to 100% because no shots are filtered",
|
|
"No change \\u2014 verification doesn't affect acceptance",
|
|
],
|
|
correct=1, section="2. Exploration", bloom="apply",
|
|
explanation="With verification='none', there are no syndrome checks, so ALL shots are accepted (100%). But quality may be lower.")"""),
|
|
code("""reflect(tracker, "q3_tradeoff",
|
|
question="After trying several parameter combinations, what tension do you notice between quality and acceptance?",
|
|
section="2. Exploration", bloom="analyze",
|
|
model_answer="Stricter verification improves quality by filtering errors, but reduces acceptance rate. The score balances this: score = quality \\u00d7 acceptance / cost.")
|
|
checkpoint_summary(tracker, "2. Exploration")"""),
|
|
]))
|
|
|
|
ins.append((ORIG - 1, [
|
|
md("---\n## Learning Dashboard"),
|
|
code("""tracker.dashboard()
|
|
path = tracker.save()
|
|
print(f"\\nProgress saved to: {path}")"""),
|
|
]))
|
|
|
|
for after_idx, cells in reversed(ins):
|
|
for i, cell in enumerate(cells):
|
|
nb["cells"].insert(after_idx + 1 + i, cell)
|
|
|
|
NB_PATH.write_text(json.dumps(nb, indent=1, ensure_ascii=False))
|
|
print(f"Enhanced dashboard: {ORIG} -> {len(nb['cells'])} cells")
|