[SPARK-7920] [MLLIB] Make MLlib ChiSqSelector Serializable (& Fix Related Documentation Example).
The MLlib ChiSqSelector class is not serializable, and so the example in the ChiSqSelector documentation fails. Also, that example is missing the import of ChiSqSelector. This PR makes ChiSqSelector extend Serializable in MLlib, and adds the ChiSqSelector import statement to the associated example in the documentation. Author: Mike Dusenberry <dusenberrymw@gmail.com> Closes #6462 from dusenberrymw/Make_ChiSqSelector_Serializable_and_Fix_Related_Docs_Example and squashes the following commits: 9cb2f94 [Mike Dusenberry] Make MLlib ChiSqSelector Serializable. d9003bf [Mike Dusenberry] Add missing import in MLlib ChiSqSelector Docs Scala example.
This commit is contained in:
parent
1617363fbb
commit
1281a35188
|
@ -410,6 +410,7 @@ import org.apache.spark.SparkContext._
|
|||
import org.apache.spark.mllib.linalg.Vectors
|
||||
import org.apache.spark.mllib.regression.LabeledPoint
|
||||
import org.apache.spark.mllib.util.MLUtils
|
||||
import org.apache.spark.mllib.feature.ChiSqSelector
|
||||
|
||||
// Load some data in libsvm format
|
||||
val data = MLUtils.loadLibSVMFile(sc, "data/mllib/sample_libsvm_data.txt")
|
||||
|
|
|
@ -108,7 +108,7 @@ class ChiSqSelectorModel (val selectedFeatures: Array[Int]) extends VectorTransf
|
|||
* (ordered by statistic value descending)
|
||||
*/
|
||||
@Experimental
|
||||
class ChiSqSelector (val numTopFeatures: Int) {
|
||||
class ChiSqSelector (val numTopFeatures: Int) extends Serializable {
|
||||
|
||||
/**
|
||||
* Returns a ChiSquared feature selector.
|
||||
|
|
Loading…
Reference in a new issue