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

    https://github.com/apache/spark/pull/15149#discussion_r79630399
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/classification/ProbabilisticClassifierSuite.scala
 ---
    @@ -56,6 +56,21 @@ class ProbabilisticClassifierSuite extends SparkFunSuite 
{
         val testModel = new TestProbabilisticClassificationModel("myuid", 2, 2)
         assert(testModel.friendlyPredict(Vectors.dense(Array(1.0, 2.0))) === 
1.0)
       }
    +
    +  test("test tiebreak") {
    +    val testModel = new TestProbabilisticClassificationModel("myuid", 2, 2)
    +      .setThresholds(Array(0.4, 0.4))
    +    assert(testModel.friendlyPredict(Vectors.dense(Array(0.6, 0.6))) === 
0.0)
    +  }
    +
    +  test("bad thresholds") {
    +    intercept[IllegalArgumentException] {
    --- End diff --
    
    @MLnick Yeah, I was wondering, the point of this PR is just to match R? 
Actually, the following works
    
    ````R
    fit <- randomForest(as.factor(V4) ~ ., data=data, cutoff=c(0.05, 0.05, 
0.05, 0.05))
    > fit$forest$cutoff = c(1000, 1000, 1000, 1)
    > table(testClass=data$V4, predict(fit, newdata=data))
    
    testClass   1   2   3   4
            1   0   3   2  56
            2   0   6   1 144
            3   0   2   3 116
            4   0   0   0  67
    ````
    So, you can actually predict with arbitrary cutoff values, perhaps this is 
hack or a bug in R. 


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