zhengruifeng opened a new pull request #27003: [SPARK-30347][ML] 
LibSVMDataSource attach AttributeGroup
URL: https://github.com/apache/spark/pull/27003
 
 
   ### What changes were proposed in this pull request?
   LibSVMDataSource attach AttributeGroup
   
   ### Why are the changes needed?
   LibSVMDataSource will attach a special metadata to indicate numFeatures:
   ```scala
    scala> val data = 
spark.read.format("libsvm").load("/data0/Dev/Opensource/spark/data/mllib/sample_multiclass_classification_data.txt")
   scala> data.schema("features").metadata
   res0: org.apache.spark.sql.types.Metadata = {"numFeatures":4}
   ```
   However, all ML impls will try to obtain vector size via AttributeGroup, 
which can not use this metadata:
   ```scala
   scala> import org.apache.spark.ml.attribute._
   import org.apache.spark.ml.attribute._scala> 
AttributeGroup.fromStructField(data.schema("features")).size
   res1: Int = -1
   ```
   
   ### Does this PR introduce any user-facing change?
   No
   
   
   ### How was this patch tested?
   added tests

----------------------------------------------------------------
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