Github user sethah commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16441#discussion_r95285636
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/classification/GBTClassifier.scala ---
    @@ -275,6 +321,13 @@ class GBTClassificationModel private[ml](
       @Since("2.0.0")
       lazy val featureImportances: Vector = 
TreeEnsembleModel.featureImportances(trees, numFeatures)
     
    +  private def classProbability(loss: String, rawPrediction: Double): 
Double = {
    --- End diff --
    
    Actually, this would be better served embedded in the loss object. One 
solution would be to make a few changes to the loss: 
    ````scala
    trait ClassificationLoss extends Loss {
      private[spark] def computeProbability(prediction: Double): Double
    }
    object LogLoss extends ClassificationLoss
    ````
    
    Then we could add a class member to the model `private val oldLoss: 
ClassificationLoss = getOldLossType`, then we can just call 
`oldLoss.computeProbability(pred)` inside `raw2ProbabilityInPlace`. There might 
be a better solution too, but really I think it should be part of the loss.


---
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

Reply via email to