zhengruifeng opened a new pull request #26547: [SPARK-29914][ML] ML models 
append metadata in `transform`/`transformSchema`
URL: https://github.com/apache/spark/pull/26547
 
 
   ### What changes were proposed in this pull request?
   1, `predictionCol` in `ml.classification` & `ml.clustering` add 
`NominalAttribute` or `BinaryAttribute` (if `numClasses`/`k` == 2)
   2, `rawPredictionCol` in `ml.classification` add `AttributeGroup` containing 
vectorsize=`numClasses`
   3, `probabilityCol` in `ml.classification` & `ml.clustering` add 
`AttributeGroup` containing vectorsize=`numClasses`/`k`
   4, `leafCol` in GBT/RF  add `AttributeGroup` containing vectorsize=`numTrees`
   5, `leafCol` in DecisionTree  add `NominalAttribute` or `BinaryAttribute` 
(if `numLeaves` == 2)
   6, `outputCol` in models in `ml.feature` add `AttributeGroup` containing 
vectorsize
   7, `outputCol` in `UnaryTransformer`s in `ml.feature` add `AttributeGroup` 
containing vectorsize
   
   ### Why are the changes needed?
   Appened metadata can be used in downstream ops, like 
`Classifier.getNumClasses`
   
   There are many impls (like 
`Binarizer`/`Bucketizer`/`VectorAssembler`/`OneHotEncoder`/`FeatureHasher`/`HashingTF`/`VectorSlicer`/...)
 in `.ml` that append appropriate metadata in `transform`/`transformSchema` 
method.
   
   However there are also many impls return no metadata in transformation, even 
some metadata like `vector.size`/`numAttrs`/`attrs` can be ealily inferred.
   
   
   ### Does this PR introduce any user-facing change?
   Yes, add some metadatas in transformed dataset.
   
   
   ### How was this patch tested?
   existing testsuites and added testsuites
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to