Xiangrui Meng created SPARK-8660:
------------------------------------

             Summary: Update comments that contain R statements in 
ml.logisticRegressionSuite
                 Key: SPARK-8660
                 URL: https://issues.apache.org/jira/browse/SPARK-8660
             Project: Spark
          Issue Type: Improvement
          Components: ML
    Affects Versions: 1.4.0
            Reporter: Xiangrui Meng
            Priority: Trivial


We put R statements as comments in unit test. However, there are two issues:

1. JavaDoc style "/** ... */" is used instead of normal multiline comment "/* 
... */".
2. We put a leading "*" on each line. It is hard to copy & paste the commands 
to/from R and verify the result.

For example, in 
https://github.com/apache/spark/blob/master/mllib/src/test/scala/org/apache/spark/ml/classification/LogisticRegressionSuite.scala#L504

{code}
    /**
     * Using the following R code to load the data and train the model using 
glmnet package.
     *
     * > library("glmnet")
     * > data <- read.csv("path", header=FALSE)
     * > label = factor(data$V1)
     * > features = as.matrix(data.frame(data$V2, data$V3, data$V4, data$V5))
     * > weights = coef(glmnet(features,label, family="binomial", alpha = 1.0, 
lambda = 6.0))
     * > weights
     * 5 x 1 sparse Matrix of class "dgCMatrix"
     *                      s0
     * (Intercept) -0.2480643
     * data.V2      0.0000000
     * data.V3       .
     * data.V4       .
     * data.V5       .
     */
{code}

should change to

{code}
    /*
      Using the following R code to load the data and train the model using 
glmnet package.
     
      library("glmnet")
      data <- read.csv("path", header=FALSE)
      label = factor(data$V1)
      features = as.matrix(data.frame(data$V2, data$V3, data$V4, data$V5))
      weights = coef(glmnet(features,label, family="binomial", alpha = 1.0, 
lambda = 6.0))
      weights

      5 x 1 sparse Matrix of class "dgCMatrix"
                           s0
      (Intercept) -0.2480643
      data.V2      0.0000000
      data.V3       .
      data.V4       .
      data.V5       .
    */
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to