Github user feynmanliang commented on a diff in the pull request:
https://github.com/apache/spark/pull/6785#discussion_r37819138
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/feature/ChiSqSelector.scala ---
@@ -99,6 +107,66 @@ class ChiSqSelectorModel (val selectedFeatures:
Array[Int]) extends VectorTransf
s"Only sparse and dense vectors are supported but got
${other.getClass}.")
}
}
+
+ override def save(sc: SparkContext, path: String): Unit = {
+ ChiSqSelectorModel.SaveLoadV1_0.save(sc, this, path)
+ }
+
+ override protected def formatVersion: String = "1.0"
+}
+
+object ChiSqSelectorModel extends Loader[ChiSqSelectorModel] {
+ override def load(sc: SparkContext, path: String): ChiSqSelectorModel = {
+ ChiSqSelectorModel.SaveLoadV1_0.load(sc, path)
+ }
+
+ private[feature]
+ object SaveLoadV1_0 {
+
+ private val thisFormatVersion = "1.0"
+
+ /** Model data for import/export */
+ case class Data(feature: Int)
--- End diff --
This is fine for now since it's being used in other places (e.g.
[LDAModel](https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/mllib/clustering/LDAModel.scala)).
However, inferring a schema from `case class`es [uses
reflection](https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala#L361)so
it would be better to just specify the schema for the data frame directly.
I'll create some JIRAs for that.
---
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]