HyukjinKwon opened a new pull request, #705:
URL: https://github.com/apache/spark-connect-rust/pull/705
### What changes were proposed in this pull request?
The 20 native feature estimators of `pyspark.ml.connect.feature` and their
models now have the surface of `pyspark.ml.feature` 4.3.0.
- **The estimators** use the base's `native_pymethods!`, with their rows
from `scripts/gen_native_params_table.py`. They have keyword-only constructors,
`setParams`, every getter and setter, the Params API, `fitMultiple`, and
`write`/`save`/`read`/`load`. `fit` returns the typed model, which holds the
estimator's defaults.
- **`QuantileDiscretizer.fit`** returns a `Bucketizer` of the fitted splits,
as PySpark's does. Its uid is new, and `outputCol` is set to the discretizer's
uid + `__output` when unset.
- **The 19 model classes** replace the shared `MLModel`, each with the
members of its PySpark class:
- the attributes, such as `vocabulary`, `idf`, `pc`, the scaler
statistics, `categoryMaps` and `surrogateDF`;
- the LSH models' `approxNearestNeighbors` and `approxSimilarityJoin`, and
Word2Vec's `getVectors`, `findSynonyms` and `findSynonymsArray`;
- `CountVectorizerModel.from_vocabulary`, and
`StringIndexerModel.from_labels` and `from_arrays_of_labels`;
- their setters and persistence.
- **Keyword arguments.** Over Spark Connect, PySpark serializes only the
positional arguments of the LSH and `findSynonyms` relations. A keyword
`distCol=` is ignored and the column stays `distCol`. The natives do the same.
### Why are the changes needed?
For parity with `pyspark.ml.feature` 4.3.0.
### Does this PR introduce _any_ user-facing change?
Yes. The estimators and models gain the APIs above, and each fit returns its
model class instead of `MLModel`.
### How was this patch tested?
- `test_ml_api_offline.py`'s surface check now covers the 39 classes.
- The cases of `test_feature_api_offline.py` and `test_feature_api_e2e.py`
now cover the estimators and models. They compare against a golden captured
from official PySpark 4.3.0. The e2e file also passes on the official
`pyspark-client`.
- The Rust `e2e_feature_models` and `e2e_ml_features` tests pass.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5
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]