zhengruifeng opened a new pull request, #650: URL: https://github.com/apache/spark-connect-rust/pull/650
### What changes were proposed in this pull request? Add native `ClusteringEvaluator`, `MultilabelClassificationEvaluator` and `RankingEvaluator` in Rust and PyO3. Complete the constructor parameters and named setters of the existing regression, binary-classification and multiclass-classification evaluators. All six use Spark's ML Evaluate command; Rust provides typed parameter getters, and both clients expose metric direction through `is_larger_better()` / `isLargerBetter()`. The Rust API remains exported from `spark_connect::ml`; Python exports remain in `pyspark.ml.connect.evaluation` and `pyspark.ml.connect`. The compatibility target is standard `pyspark.ml.evaluation` in PySpark 4.3.0. Vendored PySpark files are unchanged. ### Why are the changes needed? The native client lacks clustering, multilabel and ranking metrics. Its existing evaluator wrappers also retain constructor defaults and input conversions from deprecated `pyspark.ml.connect`, which differ from standard Spark ML. ### Does this PR introduce _any_ user-facing change? Yes. All six evaluator algorithms and their 39 metrics are available natively, including weights, regression through the origin, binary score bins, per-label/beta metrics, multiclass log-loss clipping, both silhouette distances, and ranking cutoffs. The existing Python wrappers intentionally move to standard Spark ML behavior: - Binary classification uses `rawPredictionCol="rawPrediction"` and `setRawPredictionCol`, replacing the deprecated `probabilityCol` argument/setter. - Multiclass classification requires keyword arguments and defaults to `metricName="f1"` instead of `accuracy`. - Column names and types go directly to Spark for validation. The wrapper no longer casts predictions, converts array scores to vectors, or normalizes field-name casing. Spark 4.3.0 accepts vectors or double arrays for clustering features; the tests preserve that behavior. Pandas DataFrames are rejected before parameter serialization/RPC. Migration notes are in `docs/compatibility.md`. Generic parameter-map APIs and evaluator persistence remain separate work. ### How was this patch tested? - Official PySpark 4.3.0 fixtures cover all 39 metrics across 83 numerical cases, parameter protobufs including null/integer-width boundaries, defaults, metric direction, and eight input-validation cases. Both Rust and native Python run the numerical comparisons against a live Spark 4.3.0 server. - Full offline Python suite: 4371 passed, 8 skipped, 14 subtests passed. Native live ML regression suite: 278 passed. The evaluator suite also passes with official PySpark: 109 passed. - Rust: 3 golden/default/direction tests, 2 live tests, and 682 library tests passed. All integration tests compile with and without `wasm-udf`; workspace formatting, Clippy with warnings denied, and release extension build passed. - Official Connect regression gate: all 87 selected files passed, 2,638 tests passed and 589 skipped. The three existing artifact/local-cluster exclusions were retained. - Public SQL API comparison found zero gaps after the two documented transport exclusions. Ruff lint and formatting checks passed. Existing ML tests were updated to assert standard evaluator behavior, including setters during an in-flight evaluation and explicit preparation of valid Spark column types. ### 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]
