Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-8660

Update comments that contain R statements in ml.logisticRegressionSuite

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 1.4.0
    • 1.5.0
    • ML

    Description

      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

          /**
           * 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       .
           */
      

      should change to

          /*
            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       .
          */
      

      Attachments

        Issue Links

          Activity

            People

              somilde@us.ibm.com somil deshmukh
              mengxr Xiangrui Meng
              DB Tsai DB Tsai
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 20m
                  20m
                  Remaining:
                  Remaining Estimate - 20m
                  20m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified