HyukjinKwon opened a new pull request, #694:
URL: https://github.com/apache/spark-connect-rust/pull/694
### What changes were proposed in this pull request?
The native `FPGrowth`, `PrefixSpan` and `ALS` of `pyspark.ml.connect` now
have the surface of their `pyspark.ml` 4.3.0 classes:
- **`FPGrowth` and `ALS`** use the base's `native_pymethods!`. They have
keyword-only constructors, `setParams`, every getter and setter, the Params
API, `fitMultiple`, and `write`/`save`/`read`/`load`.
- **`FPGrowthModel` and `ALSModel`** are typed models of `native_model!`.
They hold their estimator's defaults, their setters and their persistence, plus:
- for `FPGrowthModel`, the `freqItemsets` and `associationRules` relations;
- for `ALSModel`, `rank`, the `userFactors` and `itemFactors` relations,
and the four `recommendFor*` methods.
- **`PrefixSpan`** has the Params API and keeps
`findFrequentSequentialPatterns`. As in Spark, it has no persistence.
### Why are the changes needed?
For parity with `pyspark.ml.fpm` and `pyspark.ml.recommendation` 4.3.0.
### Does this PR introduce _any_ user-facing change?
Yes. The classes gain the APIs above. A fitted model now behaves as
PySpark's with a DataFrame of another session:
- its `transform` fails at collect with `CONNECT_ML.CACHE_INVALID`;
- `recommendForUserSubset` and `recommendForItemSubset` work.
Before, both raised `ValueError` at the call.
### How was this patch tested?
- `test_ml_api_offline.py`'s surface check now covers the five classes.
- New cases in `test_fpm_recommendation_api_offline.py` and
`test_fpm_recommendation_api_e2e.py` compare against a golden captured from
official PySpark 4.3.0.
- `test_als_e2e.py` and `test_frequent_patterns_e2e.py` now check the
other-session behavior.
- All the e2e files also pass on the official `pyspark-client`.
### 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]