--- id: polars-ols version: "0.3.5" license: unclear license_treatment: unclear maintenance: dormant --- # polars-ols — Polars Least Squares Extension License: unclear · Maintenance: dormant · Downloads: 102.9K/mo ## What it is and what it does Polars OLS is a Rust-based extension that adds least-squares regression capabilities directly to Polars DataFrames. It implements common linear regression variants—ordinary least squares, weighted least squares, Ridge, Elastic Net, non-negative least squares, and recursive least squares—and exposes them as Polars expressions that integrate seamlessly into Polars' lazy evaluation and grouping workflows. Instead of converting data to NumPy or scikit-learn, you chain regression calls like any other Polars expression, supporting sample weighting, L1/L2 regularization, non-negativity constraints, and a patsy-style formula API. It can compute predictions, residuals, coefficients, or statistical summaries (for OLS/WLS/Ridge), and scales across groups via `.over()` or `.group_by()` with native Rust parallelism. Use it for: - Fit OLS or Ridge models within a Polars pipeline without leaving lazy evaluation or converting to NumPy - Compute per-group regression coefficients using `.group_by()` or `.over()` in parallel - Build weighted least-squares models with sample weights directly from a Polars column - Extract statistical summaries (R², MAE, MSE, p-values) for OLS/WLS/Ridge models in one expression - Use patsy formula syntax (e.g., 'y ~ x1 + x2 + x1:x2') to specify models without manual feature engineering ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Polars OLS provides Rust-optimized linear regression models (OLS, WLS, Ridge, Elastic Net, non-negative least squares, recursive least squares) as Polars expressions, enabling efficient least-squares estimation within Polars workflows. Yes, if you are already using Polars and need to fit linear models without leaving the Polars ecosystem or converting to external libraries. No, if the package is dormant (last release 719 days ago, no visible recent commits) and you need active maintenance or bug fixes. Verify the license before use in proprietary projects. ## Install pip install polars-ols uv add polars-ols poetry add polars-ols ## Installing polars-ols Before you install: Medium install friction due to compiled wheels for multiple platforms (cp38-abi3 across macOS, Linux, Windows architectures). Single runtime dependency on polars. Maintenance status is dormant: last release was 719 days ago with no recent commits visible. License in practice: License treatment is unclear—no SPDX identifier or raw license text provided in metadata. Verify the actual license before adopting in proprietary or restricted-license projects. Quickstart: pip install polars-ols import polars as pl import polars_ols as pls df = pl.DataFrame({"y": [1.16, -2.16], "x1": [0.72, -2.43], "x2": [0.24, 0.18]}) predictions = df.with_columns( pl.col("y").least_squares.ols(pl.col("x1", "x2"), add_intercept=True).alias("pred") ) Requires polars to be installed first. Python >= 3.8. Verify before relying: - Whether the package is actively maintained or seeking new maintainers (dormant status, no recent commits) - Actual license terms and compatibility with your project's licensing constraints - Performance benchmarks relative to scikit-learn or statsmodels for your specific use case - Whether formula API (patsy syntax) is fully documented and stable ## Package facts - License: not declared (unclear) - Python support: supports_current - Install friction: medium - Maintenance: dormant - Downloads: 102.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags polars linear regression, least squares polars extension, ols regression polars, polars statistical modeling, ridge regression polars, weighted least squares polars, polars formula api regression, polars-extension, linear-regression, rust-accelerated [View on SkillFed](https://skillfed.io/packages/polars-ols) · [View on PyPI](https://pypi.org/project/polars-ols/)