Github user dbtsai commented on a diff in the pull request:
https://github.com/apache/spark/pull/7884#discussion_r38590409
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
---
@@ -218,31 +217,51 @@ class LogisticRegression(override val uid: String)
override def getThreshold: Double = super.getThreshold
+ /**
+ * Whether to over-/undersamples each of training sample according to
the given
+ * weight in `weightCol`. If empty, all samples are supposed to have
weights as 1.0.
+ * Default is empty, so all samples have weight one.
+ * @group setParam
+ */
+ def setWeightCol(value: String): this.type = set(weightCol, value)
+ setDefault(weightCol -> "")
+
override def setThresholds(value: Array[Double]): this.type =
super.setThresholds(value)
override def getThresholds: Array[Double] = super.getThresholds
override protected def train(dataset: DataFrame):
LogisticRegressionModel = {
// Extract columns from data. If dataset is persisted, do not persist
oldDataset.
- val instances = extractLabeledPoints(dataset).map {
- case LabeledPoint(label: Double, features: Vector) => (label,
features)
+ val instances: RDD[(Double, Double, Vector)] = if
($(weightCol).isEmpty) {
--- End diff --
How about I have `WeightedLabelPoint` together with `LabledPoint` but I
make it private so LiR and IsotonicRegression can use it?
---
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]