Skip to content

Export workflow as a Jupyter notebook (.ipynb) #3

Description

@jeanclawd

Problem

Today the only way to take work out of Scikit-Learner is a .joblib dump of one trained model. To keep iterating (preprocessing, hyperparameter search, ensembling, custom features) users have to rewrite the training code from scratch in their own notebook.

Proposal

Add an Export Notebook action that generates a .ipynb file mirroring exactly what the user did in the UI:

  1. Cell: load the dataset (built-in via sklearn.datasets.* or pd.read_csv from a placeholder path for uploads).
  2. Cell: select target and features.
  3. Cell: instantiate each selected model with the same hyperparameters.
  4. Cell: run cross-validation with the same folds and metrics.
  5. Cell: render the same Plotly charts (scatter / residuals / ROC / confusion matrix / comparison).
  6. Final cell: a model.predict(...) example.

Implementation notes

  • nbformat has a Pyodide wheel — use it in frontend/py/learner.py to build the notebook in-Pyodide.
  • Add a top-level export_notebook() function that returns notebook JSON as bytes.
  • Hook the JS side via pyCallBinarydownloadBytes(..., '.ipynb', 'application/x-ipynb+json').

Acceptance criteria

  • Generated notebook runs top-to-bottom in a fresh JupyterLab/Colab kernel without manual edits, for built-in datasets.
  • All selected models are reproduced with their exact hyperparameters.
  • Plotly charts render inline.
  • For uploaded CSVs the notebook contains a clear `# TODO: point pd.read_csv to your local file` marker.

Strategic rationale

This is the bridge that turns Scikit-Learner from a nice demo into a real prototyping tool — users spin up an experiment in the browser and continue in a real notebook in under 2 minutes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions