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

    https://github.com/apache/spark/pull/17757#discussion_r113361559
  
    --- Diff: R/pkg/inst/tests/testthat/test_mllib_classification.R ---
    @@ -284,22 +284,11 @@ test_that("spark.mlp", {
                    c("1.0", "1.0", "1.0", "1.0", "0.0", "1.0", "2.0", "2.0", 
"1.0", "0.0"))
     
       # test initialWeights
    -  model <- spark.mlp(df, label ~ features, layers = c(4, 3), maxIter = 2, 
initialWeights =
    +  model <- spark.mlp(df, label ~ features, layers = c(4, 3), 
initialWeights =
         c(0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 9, 9, 9, 9, 9))
       mlpPredictions <- collect(select(predict(model, mlpTestDF), 
"prediction"))
       expect_equal(head(mlpPredictions$prediction, 10),
    -               c("1.0", "1.0", "1.0", "1.0", "2.0", "1.0", "2.0", "2.0", 
"1.0", "0.0"))
    -
    -  model <- spark.mlp(df, label ~ features, layers = c(4, 3), maxIter = 2, 
initialWeights =
    -    c(0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 5.0, 5.0, 9.0, 9.0, 9.0, 
9.0, 9.0))
    -  mlpPredictions <- collect(select(predict(model, mlpTestDF), 
"prediction"))
    -  expect_equal(head(mlpPredictions$prediction, 10),
    -               c("1.0", "1.0", "1.0", "1.0", "2.0", "1.0", "2.0", "2.0", 
"1.0", "0.0"))
    -
    -  model <- spark.mlp(df, label ~ features, layers = c(4, 3), maxIter = 2)
    -  mlpPredictions <- collect(select(predict(model, mlpTestDF), 
"prediction"))
    -  expect_equal(head(mlpPredictions$prediction, 10),
    -               c("1.0", "1.0", "1.0", "1.0", "0.0", "1.0", "0.0", "2.0", 
"1.0", "0.0"))
    +               c("1.0", "1.0", "1.0", "1.0", "0.0", "1.0", "2.0", "2.0", 
"1.0", "0.0"))
    --- End diff --
    
    Yeah, here we just removed the unconverged test(with ```maxIter = 2```), 
since we can't guarantee any equality during the iteration. I think the best 
way to test the api works well is to check number of iterations. If we set 
proper initial weights, the number of iterations to converge would be different 
from other initial weights or no initial weights. Let's open a separate JIRA to 
expose training summary for MLP at MLlib side, and then we can expose them at 
SparkR and add check here. Thanks.


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