Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1997#discussion_r16328293
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/stat/test/ChiSqTest.scala ---
    @@ -75,21 +77,42 @@ private[stat] object ChiSqTest extends Logging {
        */
       def chiSquaredFeatures(data: RDD[LabeledPoint],
           methodName: String = PEARSON.name): Array[ChiSqTestResult] = {
    +    val maxCategories = 10000
         val numCols = data.first().features.size
         val results = new Array[ChiSqTestResult](numCols)
         var labels: Map[Double, Int] = null
    -    // At most 100 columns at a time
    -    val batchSize = 100
    +    // at most 1000 columns at a time
    +    val batchSize = 1000
         var batch = 0
         while (batch * batchSize < numCols) {
           // The following block of code can be cleaned up and made public as
           // chiSquared(data: RDD[(V1, V2)])
           val startCol = batch * batchSize
           val endCol = startCol + math.min(batchSize, numCols - startCol)
    -      val pairCounts = data.flatMap { p =>
    -        // assume dense vectors
    -        p.features.toArray.slice(startCol, endCol).zipWithIndex.map { case 
(feature, col) =>
    --- End diff --
    
    Should use `zipWithIndex` before slicing.


---
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]

Reply via email to