Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/7972#discussion_r36363058
--- Diff: mllib/src/main/scala/org/apache/spark/ml/util/SchemaUtils.scala
---
@@ -72,4 +74,21 @@ private[spark] object SchemaUtils {
require(!schema.fieldNames.contains(col.name), s"Column ${col.name}
already exists.")
StructType(schema.fields :+ col)
}
+
+ /**
+ * Takes a Vector column and a list of feature names, and returns the
corresponding list of
+ * feature indices in the column, in order.
+ * @param col Vector column which must have feature names specified via
attributes
+ * @param names List of feature names
+ */
+ def getFeatureIndicesFromNames(col: StructField, names: Array[String]):
Array[Int] = {
--- End diff --
Maybe this should go to `MetadataUtils`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]