You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (Jira)" <ji...@apache.org> on 2020/10/12 08:24:00 UTC

[jira] [Commented] (SPARK-32455) LogisticRegressionModel prediction optimization

    [ https://issues.apache.org/jira/browse/SPARK-32455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17212226#comment-17212226 ] 

Apache Spark commented on SPARK-32455:
--------------------------------------

User 'zhengruifeng' has created a pull request for this issue:
https://github.com/apache/spark/pull/30013

> 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
>            Assignee: zhengruifeng
>            Priority: Minor
>             Fix For: 3.1.0
>
>
> 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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org