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

   ### What changes were proposed in this pull request?
   
   Add native `spark_connect::ml::RandomForestClassifier` and 
`RandomForestClassificationModel`. Training uses Spark's ML fit command; 
DataFrame transforms refer to the session-scoped fitted model and return 
predictions, probabilities, raw predictions and optional per-tree leaf indices. 
Models, clones and lazy transformed DataFrames share ownership of the cached 
server model.
   
   Rust builder setters cover all 22 Spark 4.3.0 constructor parameters, 
including `pruneTree`, plus inherited class thresholds. Add the corresponding 
native Python estimator under `pyspark.ml.connect.classification` and 
`pyspark.ml.connect`, with PySpark's keyword-only constructor names/defaults 
and mutating setters. Add reference wire fixtures, native integration tests, CI 
selection and compatibility documentation.
   
   JIRA: https://issues.apache.org/jira/browse/SPARK-61358
   
   ### Why are the changes needed?
   
   The native Rust ML API lacks a random forest classifier. This adds binary 
and multiclass tree-based classification alongside the existing linear 
classifiers, using the established model-cache infrastructure.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Rust and native Python users can fit random forests and transform 
DataFrames, configure sampling and instance weights, and adjust predictions 
using class thresholds. A depth-three forest learns the test's nonlinear labels 
(class 1 in the middle, class 0 on either side) and predicts unseen rows.
   
   This native addition exposes fit and DataFrame transform. Tree inspection, 
feature importances, summaries, single-vector prediction and persistence remain 
outside its API; these limits are documented.
   
   ### How was this patch tested?
   
   - Five native Rust tests against a local Spark 4.3.0 Connect server: learned 
binary/multiclass forests, separate fitted references, lazy ownership/cloning, 
cross-session rejection, probabilities/raw predictions/leaf outputs, weights, 
thresholds, seeded bootstrap/feature sampling and invalid input.
   - Six new Python cases passed against both official PySpark and the native 
binding. All 17 selected native estimator integration cases passed.
   - Golden parameter matches for all 23 setters and six integer seed 
boundaries. Two Python offline cases verify constructor/setter requests against 
the same official fixtures and check the constructor signature/defaults.
   - Rust library: 567 passed. Python offline: 1,749 passed, 8 skipped. All 
Rust integration targets compile with and without `wasm-udf`; formatting and 
targeted Clippy pass. Core API introspection shows no new missing public names 
across the 12 checked classes.
   - Official Connect single-node suite through the Rust transport: all 87 
files passed; 2,638 tests passed, 589 skipped, zero unexpected failures (the 
same three local-cluster exclusions used by CI).
   - Workspace/Python-binding Clippy reports existing errors: exact-master 
comparison found 55 matching error sites and zero new sites.
   - An additional broad Rust test run stalled in existing offline 
execution-hook tests. The same hook test also times out on unchanged master; 
the required library tests and compile-all checks pass.
   
   ### 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