[ https://issues.apache.org/jira/browse/SPARK-32455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17165552#comment-17165552 ]
Apache Spark commented on SPARK-32455: -------------------------------------- User 'zhengruifeng' has created a pull request for this issue: https://github.com/apache/spark/pull/29255 > LogisticRegressionModel prediction optimization > ----------------------------------------------- > > Key: SPARK-32455 > URL: https://issues.apache.org/jira/browse/SPARK-32455 > Project: Spark > Issue Type: Improvement > Components: ML > Affects Versions: 3.1.0 > Reporter: zhengruifeng > Priority: Minor > > if needed, method getThreshold and/or following logic to compute rawThreshold > is called on each instance. > > {code:java} > override def getThreshold: Double = { > checkThresholdConsistency() > if (isSet(thresholds)) { > val ts = $(thresholds) > require(ts.length == 2, "Logistic Regression getThreshold only applies > to" + > " binary classification, but thresholds has length != 2. thresholds: " > + ts.mkString(",")) > 1.0 / (1.0 + ts(0) / ts(1)) > } else { > $(threshold) > } > } {code} > > {code:java} > val rawThreshold = if (t == 0.0) { > Double.NegativeInfinity > } else if (t == 1.0) { > Double.PositiveInfinity > } else { > math.log(t / (1.0 - t)) > } {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org