Skip to content

Commit 8d2b57d

Browse files
committed
[SPARK-50812][ML][PYTHON][CONNECT] Support TargetEncoderModel on Connect
### What changes were proposed in this pull request? Support TargetEncoderModel on Connect ### Why are the changes needed? feature parity ### Does this PR introduce _any_ user-facing change? yes ### How was this patch tested? enabled parity tests ### Was this patch authored or co-authored using generative AI tooling? no Closes #49648 from zhengruifeng/ml_connect_te. Authored-by: Ruifeng Zheng <[email protected]> Signed-off-by: Ruifeng Zheng <[email protected]>
1 parent 21f0512 commit 8d2b57d

File tree

4 files changed

+4
-10
lines changed

4 files changed

+4
-10
lines changed

mllib/src/main/resources/META-INF/services/org.apache.spark.ml.Estimator

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ org.apache.spark.ml.feature.PCA
6060
org.apache.spark.ml.feature.Word2Vec
6161
org.apache.spark.ml.feature.CountVectorizer
6262
org.apache.spark.ml.feature.OneHotEncoder
63-
63+
org.apache.spark.ml.feature.TargetEncoder

mllib/src/main/resources/META-INF/services/org.apache.spark.ml.Transformer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ org.apache.spark.ml.feature.PCAModel
6565
org.apache.spark.ml.feature.Word2VecModel
6666
org.apache.spark.ml.feature.CountVectorizerModel
6767
org.apache.spark.ml.feature.OneHotEncoderModel
68-
68+
org.apache.spark.ml.feature.TargetEncoderModel

mllib/src/main/scala/org/apache/spark/ml/feature/TargetEncoder.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ class TargetEncoderModel private[ml] (
286286
@Since("4.0.0") private[ml] val stats: Array[Map[Double, (Double, Double)]])
287287
extends Model[TargetEncoderModel] with TargetEncoderBase with MLWritable {
288288

289+
private[ml] def this() = this(Identifiable.randomUID("TargetEncoder"), Array.empty)
290+
289291
/** @group setParam */
290292
@Since("4.0.0")
291293
def setInputCol(value: String): this.type = set(inputCol, value)

python/pyspark/ml/tests/connect/test_parity_feature.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,6 @@ def test_string_indexer_handle_invalid(self):
5858
def test_string_indexer_from_labels(self):
5959
super().test_string_indexer_from_labels()
6060

61-
@unittest.skip("Need to support.")
62-
def test_target_encoder_binary(self):
63-
super().test_target_encoder_binary()
64-
65-
@unittest.skip("Need to support.")
66-
def test_target_encoder_continuous(self):
67-
super().test_target_encoder_continuous()
68-
6961
@unittest.skip("Need to support.")
7062
def test_vector_size_hint(self):
7163
super().test_vector_size_hint()

0 commit comments

Comments
 (0)