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
- is related to
-
SPARK-8661 Update comments that contain R statements in ml.LinearRegressionSuite
- Resolved
- links to