You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/12/24 10:49:07 UTC
[GitHub] [spark] zhengruifeng commented on issue #27003: [SPARK-30347][ML]
LibSVMDataSource attach AttributeGroup
zhengruifeng commented on issue #27003: [SPARK-30347][ML] LibSVMDataSource attach AttributeGroup
URL: https://github.com/apache/spark/pull/27003#issuecomment-568722282
After this PR, `LibSVMDataSource` will attach `AttributeGroup` for ML impls, while keep current metata.
```scala
scala> import org.apache.spark.ml.attribute._
import org.apache.spark.ml.attribute._
scala> val data = spark.read.format("libsvm").load("/data0/Dev/Opensource/spark/data/mllib/sample_multiclass_classification_data.txt")
19/12/24 18:47:35 WARN LibSVMFileFormat: 'numFeatures' option not specified, determining the number of features by going though the input. If you know the number in advance, please specify it via 'numFeatures' option to avoid the extra scan.
data: org.apache.spark.sql.DataFrame = [label: double, features: vector]
scala> data.schema("features").metadata
res0: org.apache.spark.sql.types.Metadata = {"ml_attr":{"num_attrs":4},"numFeatures":4}
scala> AttributeGroup.fromStructField(data.schema("features")).size
res1: Int = 4
```
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org