Github user yanboliang commented on a diff in the pull request: https://github.com/apache/spark/pull/15721#discussion_r93761461 --- Diff: mllib/src/test/scala/org/apache/spark/ml/util/MLTestingUtils.scala --- @@ -182,34 +182,18 @@ object MLTestingUtils extends SparkFunSuite { .toMap } - def genClassificationInstancesWithWeightedOutliers( - spark: SparkSession, - numClasses: Int, - numInstances: Int): DataFrame = { - val data = Array.tabulate[Instance](numInstances) { i => - val feature = i % numClasses - if (i < numInstances / 3) { - // give large weights to minority of data with 1 to 1 mapping feature to label - Instance(feature, 1.0, Vectors.dense(feature)) - } else { - // give small weights to majority of data points with reverse mapping - Instance(numClasses - feature - 1, 0.01, Vectors.dense(feature)) - } - } - val labelMeta = - NominalAttribute.defaultAttr.withName("label").withNumValues(numClasses).toMetadata() - spark.createDataFrame(data).select(col("label").as("label", labelMeta), col("weight"), - col("features")) - } - + /** + * Given a dataframe, generate two output dataframes: one having the original rows oversampled + * an integer number of times, and one having the original rows but with a column of weights + * proportional to the number of oversampled instances in the oversampled dataframe. + */ def genEquivalentOversampledAndWeightedInstances( --- End diff -- For this and the following three functions, some one uses ```data: DataFrame, labelCol: String, featuresCol```, while others use ```data: Dataset[LabeledPoint]``` or ```data: Dataset[Instance]``` as the arguments. Could we make the arguments consistent? I'm prefer the latter one.
--- 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