Skip to content

Commit

Permalink
move asBinary to LogisticRegression
Browse files Browse the repository at this point in the history
  • Loading branch information
huaxingao committed Jun 18, 2020
1 parent 61e93d0 commit e844c11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Expand Up @@ -142,17 +142,6 @@ private[classification] trait ClassificationSummary extends Serializable {
/** Returns weighted averaged f1-measure. */
@Since("3.1.0")
def weightedFMeasure: Double = multiclassMetrics.weightedFMeasure(1.0)

/**
* Convenient method for casting to binary classification summary.
* This method will throw an Exception if the summary is not a binary summary.
*/
@Since("3.1.0")
def asBinary: BinaryClassificationSummary = this match {
case b: BinaryClassificationSummary => b
case _ =>
throw new RuntimeException("Cannot cast to a binary summary.")
}
}

/**
Expand Down
Expand Up @@ -1402,6 +1402,17 @@ sealed trait LogisticRegressionSummary extends ClassificationSummary {
/** Field in "predictions" which gives the features of each instance as a vector. */
@Since("1.6.0")
def featuresCol: String

/**
* Convenient method for casting to binary logistic regression summary.
* This method will throw an Exception if the summary is not a binary summary.
*/
@Since("2.3.0")
def asBinary: BinaryLogisticRegressionSummary = this match {
case b: BinaryLogisticRegressionSummary => b
case _ =>
throw new RuntimeException("Cannot cast to a binary summary.")
}
}

/**
Expand Down
1 change: 0 additions & 1 deletion project/MimaExcludes.scala
Expand Up @@ -66,7 +66,6 @@ object MimaExcludes {
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("org.apache.spark.ml.classification.BinaryLogisticRegressionTrainingSummary.org$apache$spark$ml$classification$ClassificationSummary$_setter_$org$apache$spark$ml$classification$ClassificationSummary$$multiclassMetrics_="),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("org.apache.spark.ml.classification.BinaryLogisticRegressionTrainingSummary.org$apache$spark$ml$classification$ClassificationSummary$$multiclassMetrics"),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("org.apache.spark.ml.classification.BinaryLogisticRegressionTrainingSummary.weightCol"),
ProblemFilters.exclude[IncompatibleResultTypeProblem]("org.apache.spark.ml.classification.LogisticRegressionSummary.asBinary"),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("org.apache.spark.ml.classification.LogisticRegressionSummary.org$apache$spark$ml$classification$ClassificationSummary$_setter_$org$apache$spark$ml$classification$ClassificationSummary$$multiclassMetrics_="),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("org.apache.spark.ml.classification.LogisticRegressionSummary.org$apache$spark$ml$classification$ClassificationSummary$$multiclassMetrics"),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("org.apache.spark.ml.classification.LogisticRegressionSummary.weightCol"),
Expand Down

0 comments on commit e844c11

Please sign in to comment.