{"id":31640063,"url":"https://github.com/alexhallam/wayne","last_synced_at":"2025-10-07T02:09:30.464Z","repository":{"id":313276407,"uuid":"1050771697","full_name":"alexhallam/wayne","owner":"alexhallam","description":"🤠Trade a formula for a model matrix🤠","archived":false,"fork":false,"pushed_at":"2025-09-14T19:18:10.000Z","size":1048,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-14T21:24:47.847Z","etag":null,"topics":["design-matrix","formula","model-matrix","polars","statistics"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexhallam.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-04T23:12:30.000Z","updated_at":"2025-09-14T19:18:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"896e871f-7bcf-4fac-b5cc-368546fb4141","html_url":"https://github.com/alexhallam/wayne","commit_stats":null,"previous_names":["alexhallam/wayne"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/alexhallam/wayne","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexhallam%2Fwayne","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexhallam%2Fwayne/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexhallam%2Fwayne/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexhallam%2Fwayne/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexhallam","download_url":"https://codeload.github.com/alexhallam/wayne/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexhallam%2Fwayne/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278708004,"owners_count":26031932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["design-matrix","formula","model-matrix","polars","statistics"],"created_at":"2025-10-07T02:09:02.636Z","updated_at":"2025-10-07T02:09:30.458Z","avatar_url":"https://github.com/alexhallam.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPI version](https://img.shields.io/pypi/v/wayne-trade.svg?cacheSeconds=600)](https://pypi.org/project/wayne-trade/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\u003ch1 align=\"center\"\u003ewayne\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"img/wayne.svg\" alt=\"logo\" width=\"240\"\u003e\n\u003c/p\u003e\n\n\n\u003ch2 align=\"center\"\u003etrade a formula to model matrix\u003c/h2\u003e\n\n\n\n\u003cp align=\"center\"\u003e\"Greet each day with a smile, so it doesn't know what you're planning on doing to it.\" - Wayne\u003c/p\u003e\n\n---\n\n**Formula to Model Matrix in One Function Call**\n\n`wyane` is a Python package that converts statistical formulas into model matrices using Polars DataFrames. It does one thing: takes a formula and a DataFrame, returns a model matrix.\n\n## Installation\n\n**Requirements**: Python 3.13+ (due to fiasto-py dependency)\n\n```bash\nuv pip install wayne-trade\n# or\npip install wayne-trade\n```\n\n## Usage\n\n```python\nimport wayne\nimport polars as pl\n\n# Load your data\ndf = pl.read_csv(\"data/mtcars.csv\")\n\n# Define your formula\nformula = 'mpg ~ cyl + wt*hp + poly(disp, 4) - 1'\n\n# Get the model matrix\nmodel_matrix = wayne.trade_formula_for_matrix(df, formula)\nprint(model_matrix)\n```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"img/mtcars_output.png\" alt=\"logo\" width=\"640\"\u003e\n\u003c/p\u003e\n\n## Wayne Speak Fiasto\n\nWayne provides a clean interface to fiasto-py's parsing functionality without requiring users to directly import fiasto-py and deal with its maturin/pyo3 complexity:\n\n```python\nimport wayne\n\n# Parse a formula to get detailed structure\nresult = wayne.speak_fiasto(\"mpg ~ cyl + wt*hp + poly(disp, 4) - 1\")\nprint(result['columns'].keys())  # All variables and their metadata\nprint(result['metadata']['has_intercept'])  # Formula metadata\nprint(result['all_generated_columns'])  # All generated column names\n```\n\n## Features\n\n- **Single Function**: `trade_formula_for_matrix(df, formula)`\n- **Polars Integration**: Works with Polars DataFrames\n- **R-Style Formulas**: Supports R/Wilkinson notation\n- **Fast Parsing**: Rust + fiasto for formula parsing\n- **Orthogonal Polynomials**: NumPy-based polynomial generation\n- **Interactions**: Handles interaction terms (e.g., `x*z`)\n- **Intercept Control**: Add/remove intercept with `+1`/`-1`\n\n## Formula Syntax\n\nWayne supports R-style statistical formulas:\n\n- **Basic terms**: `y ~ x + z`\n- **Interactions**: `y ~ x*z` (expands to `x + z + x:z`)\n- **Polynomial terms**: `y ~ poly(x, 3)` (generates 3 orthogonal polynomial columns)\n- **Intercept control**: `y ~ x - 1` (removes intercept)\n- **Complex formulas**: `y ~ x + z + poly(w, 3) + x:z - 1`\n\n## Examples\n\nSee the `examples/` directory for complete examples:\n\n```bash\n# Main example\nuv run python examples/final_example.py\n\n# Single function demo\nuv run python examples/single_function_example.py\n```\n\n## What You Get\n\nThe model matrix contains:\n- **Main effects**: Original variables from your formula\n- **Interaction terms**: Generated interaction columns (e.g., `wt_hp` for `wt*hp`)\n- **Polynomial terms**: Orthogonal polynomial columns (e.g., `disp_poly_1`, `disp_poly_2`, etc.)\n\n## Development \u0026 Releases\n\nFor developers and maintainers:\n\n- **Release Process**: See [RELEASE.md](RELEASE.md) for how to release new versions to PyPI\n- **Automatic Releases**: Pushing changes to `CHANGELOG.md` triggers automatic PyPI releases\n- **Testing**: Run `uv run -m pytest` to run the test suite\n- **Polynomial Validation**: Run `uv run compare_polynomials.py` to verify R compatibility\n- **Intercept**: Optional intercept column\n\n## Perfect for Statistical Modeling\n\nWayne creates model matrices that are ready for:\n- Linear regression\n- Generalized linear models\n- Mixed effects models\n- Any statistical modeling that needs a design matrix\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexhallam%2Fwayne","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexhallam%2Fwayne","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexhallam%2Fwayne/lists"}