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

    https://github.com/apache/spark/pull/11136#discussion_r54508370
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/regression/GeneralizedLinearRegressionSuite.scala
 ---
    @@ -0,0 +1,499 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.ml.regression
    +
    +import scala.util.Random
    +
    +import org.apache.spark.SparkFunSuite
    +import org.apache.spark.ml.param.ParamsSuite
    +import org.apache.spark.ml.util.MLTestingUtils
    +import org.apache.spark.mllib.classification.LogisticRegressionSuite._
    +import org.apache.spark.mllib.linalg.{BLAS, DenseVector, Vectors}
    +import org.apache.spark.mllib.random._
    +import org.apache.spark.mllib.regression.LabeledPoint
    +import org.apache.spark.mllib.util.MLlibTestSparkContext
    +import org.apache.spark.mllib.util.TestingUtils._
    +import org.apache.spark.sql.{DataFrame, Row}
    +
    +class GeneralizedLinearRegressionSuite extends SparkFunSuite with 
MLlibTestSparkContext {
    +
    +  private val seed: Int = 42
    +  @transient var datasetGaussianIdentity: DataFrame = _
    +  @transient var datasetGaussianLog: DataFrame = _
    +  @transient var datasetGaussianInverse: DataFrame = _
    +  @transient var datasetBinomial: DataFrame = _
    +  @transient var datasetPoissonLog: DataFrame = _
    +  @transient var datasetPoissonIdentity: DataFrame = _
    +  @transient var datasetPoissonSqrt: DataFrame = _
    +  @transient var datasetGammaInverse: DataFrame = _
    +  @transient var datasetGammaIdentity: DataFrame = _
    +  @transient var datasetGammaLog: DataFrame = _
    +
    +  override def beforeAll(): Unit = {
    +    super.beforeAll()
    +
    +    import GeneralizedLinearRegressionSuite._
    +
    +    datasetGaussianIdentity = sqlContext.createDataFrame(
    +      sc.parallelize(generateGeneralizedLinearRegressionInput(
    +        intercept = 2.5, coefficients = Array(2.2, 0.6), xMean = 
Array(2.9, 10.5),
    +        xVariance = Array(0.7, 1.2), nPoints = 10000, seed, eps = 0.01,
    +        family = "gaussian", link = "identity"), 2))
    +
    +    datasetGaussianLog = sqlContext.createDataFrame(
    +      sc.parallelize(generateGeneralizedLinearRegressionInput(
    +        intercept = 0.25, coefficients = Array(0.22, 0.06), xMean = 
Array(2.9, 10.5),
    +        xVariance = Array(0.7, 1.2), nPoints = 10000, seed, eps = 0.01,
    +        family = "gaussian", link = "log"), 2))
    +
    +    datasetGaussianInverse = sqlContext.createDataFrame(
    +      sc.parallelize(generateGeneralizedLinearRegressionInput(
    +        intercept = 2.5, coefficients = Array(2.2, 0.6), xMean = 
Array(2.9, 10.5),
    +        xVariance = Array(0.7, 1.2), nPoints = 10000, seed, eps = 0.01,
    +        family = "gaussian", link = "inverse"), 2))
    +
    +    datasetBinomial = {
    +      val nPoints = 10000
    +      val coefficients = Array(-0.57997, 0.912083, -0.371077, -0.819866, 
2.688191)
    +      val xMean = Array(5.843, 3.057, 3.758, 1.199)
    +      val xVariance = Array(0.6856, 0.1899, 3.116, 0.581)
    +
    +      val testData =
    +        generateMultinomialLogisticInput(coefficients, xMean, xVariance, 
true, nPoints, seed)
    +
    +      sqlContext.createDataFrame(sc.parallelize(testData, 4))
    --- End diff --
    
    Why using 4 partitions instead of 2, which is used in other datasets?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to