zhengruifeng opened a new pull request, #888:
URL: https://github.com/apache/spark-connect-rust/pull/888

   ### What changes were proposed in this pull request?
   
   Make `from pyspark.ml.classification import LogisticRegression` use the 
existing Rust ML implementation for fit, transform, model access, evaluation, 
and persistence. Today the standard class constructs these requests through 
upstream Python helpers, even though the repository already has native 
LogisticRegression operations.
   
   This draft covers LogisticRegression, LogisticRegressionModel, and their 
four summary classes:
   
   - Keep Python `Params`, setters, signatures, copying, pickling, and subclass 
dispatch. Synchronize parameters into the native object when an operation 
consumes them.
   - Delegate the operations through the existing PyO3 bindings and Rust ML 
core, which own request construction, model references, and transport.
   - Load unchanged upstream classification definitions from 
`_upstream/classification.py`, then publish the six native-backed classes under 
the standard module. The vendored source remains byte-identical and is checked 
at its new path.
   - Keep the existing native namespace's six exports as aliases, including in 
generated type stubs. Preserve static exports for the other classification 
classes.
   - Initialize the shared native reader/writer adapters on use and during 
pickle restoration, including in fresh interpreters.
   
   The design and acceptance criteria are in [the feature 
spec](https://github.com/zhengruifeng/spark-connect-rust/blob/prototype/standard-logistic-rust/specs/features/standard-logistic-rust.md).
 Other standard estimators keep their existing implementation.
   
   ### Why are the changes needed?
   
   This demonstrates an incremental move of standard Python ML operations into 
the Rust implementation while retaining Python API behavior. It gives reviewers 
a concrete LogisticRegression example before extending the approach to other 
algorithms. Performance has not been measured.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Standard LogisticRegression and its returned models/summaries become 
native-backed objects. The existing native import and the standard import 
identify the same six classes. Python setters remain local Python parameter 
updates, and Python subclass hooks continue to dispatch through the standard 
API. Training still executes on the Spark server.
   
   ### How was this patch tested?
   
   Against Spark 4.3.0 with Python 3.13:
   
   - Offline API/subclass/standard-import checks: **874 passed, 68 skipped**. 
Includes both import orders, parameter overrides, copying/pickling, and 
fresh-process reader/writer restoration.
   - Live standard LogisticRegression and existing golden cases: **4 passed**. 
Python ML request builders are disabled in the new tests; they cover fit, 
transform, coefficients, prediction, summaries/evaluation, save/load, subclass 
delegation, and lazy model lifetime. The new live file is wired into CI.
   - Official Spark classification tests selected by `logistic or 
invalid_load`: **7 passed, 10 deselected**, including binomial/multinomial 
regression and persistence.
   - Affected typing/docstring checks: **4 passed, 1 skipped** (pyright 
unavailable). Mypy also checked all public standard classification imports. 
Generated-stub drift, vendor drift, Ruff, and whitespace checks passed.
   - Broader ML offline suite: **416 passed, 3 failed**. The same three 
failures reproduce on unchanged master in this environment: Python 3.13 reports 
`Can't get local object` where the tests expect `Can't pickle local object`.
   
   **Validation limitations:** runtime checks used the extension from [CI run 
44477221016](https://github.com/apache/spark-connect-rust/actions/runs/44477221016),
 commit `47cf486b347bda9675868074f0d12248429f4c2a`; the relevant Rust ML 
sources match this draft's base. No Rust source was changed. Cargo/rustc are 
unavailable locally, so the mandatory Rust build/fmt/clippy checks could not 
run and the extension was not rebuilt locally. Full-project official parity and 
coverage gates have not been run. This PR remains a draft for design review.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Codex (GPT-6)
   
   This pull request and its description were written by Isaac.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to