Ruifeng Zheng created SPARK-50988:
-------------------------------------

             Summary: Make model uid consistent with estimator
                 Key: SPARK-50988
                 URL: https://issues.apache.org/jira/browse/SPARK-50988
             Project: Spark
          Issue Type: Sub-task
          Components: Connect, ML
    Affects Versions: 4.0.0
            Reporter: Ruifeng Zheng


{code:java}
In [1]: from pyspark.ml.linalg import Vectors, Matrices
   ...: from pyspark.sql import SparkSession, DataFrame
   ...: from pyspark.ml.classification import *

In [2]: df = spark.createDataFrame(
   ...:                 [
   ...:                     (1.0, 1.0, Vectors.dense(0.0, 5.0)),
   ...:                     (0.0, 2.0, Vectors.dense(1.0, 2.0)),
   ...:                     (1.0, 3.0, Vectors.dense(2.0, 1.0)),
   ...:                     (0.0, 4.0, Vectors.dense(3.0, 3.0)),
   ...:                 ],
   ...:                 ["label", "weight", "features"],
   ...:             )

In [3]: svc = LinearSVC(maxIter=1, regParam=1.0)In [4]: svc.uid
Out[4]: 'LinearSVC_2630f5817c54'

In [5]: model = svc.fit(df)
25/01/25 15:47:59 WARN CheckAllocator: More than one DefaultAllocationManager 
on classpath. Choosing first found
[********************************************************************************]
 100.00% Complete (0 Tasks running, 2s, Scanned 0.0 B)25/01/25 15:48:01 WARN 
InstanceBuilder: Failed to load implementation 
from:dev.ludovic.netlib.blas.JNIBLAS

In [6]: model.uid
Out[6]: 'LinearSVCModel_87ad7716304b' {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to