Skip to content

Convert vignette examples to standalone instructional scripts#129

Merged
OVVO-Financial merged 17 commits into
mainfrom
claude/r-vignette-python-fidelity-0d6f2g
Jul 16, 2026
Merged

Convert vignette examples to standalone instructional scripts#129
OVVO-Financial merged 17 commits into
mainfrom
claude/r-vignette-python-fidelity-0d6f2g

Conversation

@OVVO-Financial

Copy link
Copy Markdown
Owner

Summary

Transforms the nine canonical NNS vignette examples from thin wrapper scripts into comprehensive, self-contained instructional Python scripts that faithfully reproduce the R vignette curriculum. Each script now includes the complete statistical narrative, demonstrations, and figure generation.

Key Changes

  • Vignette Scripts (01–09): Converted from single-line imports to full implementations with:

    • Complete section-by-section structure matching R vignettes
    • Inline statistical demonstrations with printed results
    • Figure generation and saving to examples/vignettes/output/
    • Proper imports of NNS functions and support utilities
    • Markdown-style comments documenting the statistical narrative
  • Support Infrastructure (examples/_vignette_support.py):

    • New shared module for dataset loading (iris, mtcars, AirPassengers)
    • Output directory management and figure saving
    • Compact result display functions (show, table, section, etc.)
    • Visualization helpers (empirical CDF, partition/regression scatter plots)
    • Fast-mode environment variable for CI runtime optimization
  • Data Files:

    • Added examples/data/iris.csv, mtcars.csv, AirPassengers.csv
    • Enables reproducible examples without external dependencies
  • Documentation:

    • PARITY.md: Ledger of R-to-Python vignette correspondence and known API gaps
    • Updated README.md and manifest.yml to reflect new structure
    • sitecustomize.py: Enables vignettes to import shared support directly
  • Testing:

    • Updated test_vignette_examples.py to run canonical scripts with fast-mode support
    • Updated test_canonical_vignette_manifest.py to verify data file presence
  • Configuration:

    • Updated .gitignore to exclude generated output directory
    • Updated pyproject.toml to allow vignette scripts to modify sys.path

Implementation Details

  • Each vignette script is now directly executable and produces both console output and saved figures
  • Scripts use consistent formatting with section headers, subsections, and gap/note callouts
  • Matplotlib figures replace R's interactive rgl 3D plots with static equivalents
  • Fast-mode reduces expensive computations (grid resolution, bootstrap iterations) for CI
  • All nine vignettes preserve the R statistical narrative order and examples while using Python idioms

https://claude.ai/code/session_014q6V4fJ7zz6KLAgu3ddhDp

OVVO-Financial and others added 17 commits July 16, 2026 00:32
Repair the failures in the full R vignette port suite:

- 01_overview: replace the thin delegate shim with a full nine-section
  instructional port of NNSvignette_01_Overview.Rmd, including figures for
  the partial-moment decomposition, mode estimation, copula surfaces,
  nonlinear regression, ARMA forecasting, and Monte Carlo replicates.
- 04_normalization: pass a list instead of a generator to np.column_stack,
  which numpy rejects at runtime.
- 05_sampling: replace the assertion-style smoke script with a full
  section-by-section port of NNSvignette_05_Sampling.Rmd with CDF,
  inverse-CDF, Monte Carlo, and dependence-transfer figures.
- 06_comparing_distributions: replace the smoke script with a full port of
  NNSvignette_06_Comparing_Distributions.Rmd, reconstructing the R ANOVA
  plot side effects from the returned statistics and adding superiority,
  dominance, and SD-cluster figures.
- 07_clustering_and_regression: restore the file body that was committed
  truncated after its module docstring, porting every R section including
  partition orders, X-only partitioning, multivariate regression over the
  full grid, dimension reduction, stacking, smoothing, and imputation.
- 08_classification and _vignette_support: stop rounding non-numeric arrays
  in the compact result renderer, and display rhs.partitions now that the
  multivariate result exposes it (correcting the stale gap note).
- PARITY.md: update the 07/08 ledger entries to match the ports.
- Lint compliance for ruff check across the examples tree, with a scoped
  E402 ignore for the sys.path bootstrap in instructional scripts, and
  ignore the generated figure output directory.

All nine canonical scripts pass tests/docs/test_vignette_examples.py in
fast mode and run clean in full mode; ruff and mypy pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014q6V4fJ7zz6KLAgu3ddhDp
@OVVO-Financial
OVVO-Financial merged commit ab73c26 into main Jul 16, 2026
18 checks passed
@OVVO-Financial
OVVO-Financial deleted the claude/r-vignette-python-fidelity-0d6f2g branch July 16, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants