huaxingao commented on a change in pull request #27841: [SPARK-31077][ML]
Remove ChiSqSelector dependency on mllib.ChiSqSelectorModel
URL: https://github.com/apache/spark/pull/27841#discussion_r390092960
##########
File path: mllib/src/main/scala/org/apache/spark/ml/stat/ChiSquareTest.scala
##########
@@ -75,4 +77,31 @@ object ChiSquareTest {
val statistics: Vector = Vectors.dense(testResults.map(_.statistic))
spark.createDataFrame(Seq(ChiSquareResult(pValues, degreesOfFreedom,
statistics)))
}
+
+ /**
+ * @param dataset DataFrame of categorical labels and categorical features.
+ * Real-valued features will be treated as categorical for
each distinct value.
+ * @param featuresCol Name of features column in dataset, of type `Vector`
(`VectorUDT`)
+ * @param labelCol Name of label column in dataset, of any numerical type
+ * @return Array containing the SelectionTestResult for every feature
against the label.
+ */
+ @Since("3.1.0")
+ def testChiSquare(
+ dataset: Dataset[_],
+ featuresCol: String,
+ labelCol: String): Array[SelectionTestResult] = {
Review comment:
I will need to have an abstract method in abstract class ```Selector``` in
next subtask
```
def getSelectionTestResult(dataset: Dataset[_]): Array[SelectionTestResult]
```
so I prefer to return ```Array[SelectionTestResult]``` here.
----------------------------------------------------------------
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]