-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-11381][DOCS] Replace example code in mllib-linear-methods.md using include_example #11320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
So many changes in this commit. |
|
ok to test |
|
cc @yinxusen |
|
Oh, thanks. I'll check the Jenkins in detail. |
|
Actually, the error was Github timeout. I pushed force again. Could you ask Jenkins to retest please? |
|
To be sure, I rebased this PR to the master, too. |
|
Test build #51805 has finished for PR 11320 at commit
|
|
Let me fix the Scala style. I thought I passed since |
|
@dongjoon-hyun You can use |
|
Thank you so much, @yinxusen ! I'll fix soon and let you know here. |
|
I've done! |
|
Test build 51808 is running now. Let's see the result. :) |
|
Hmm, it fails again due to Github. |
|
According to Jenkins, other PRs also suffer from this. I think |
|
We can wait for a while. No worry. |
…sing include_example This PR replaces example codes in mllib-linear-methods.md using `include_example` by doing the followings: * Extracts the example codes(Scala,Java,Python) as files in `example` module. * Merges some dialog-style examples into a single file. * Hide redundant codes in HTML for the consistency with other docs. * Move the output directory into 'target/tmp'.
|
Test build #51825 has finished for PR 11320 at commit
|
|
Finally! Now, it's ready to be reviewed again. :) |
|
I'll do it tomorrow. Thx On Wed, Feb 24, 2016 at 3:12 PM, Dongjoon Hyun [email protected]
CheersXusen Yin (尹绪森) |
|
Thank you, @yinxusen ! |
| // $example on$ | ||
| SVMWithSGD svmAlg = new SVMWithSGD(); | ||
| svmAlg.optimizer() | ||
| .setNumIterations(200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dongjoon-hyun All Java files should follow 2-indent style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yinxusen . My bad.
I updated the PR to fix it.
|
Let's remove those examples:
For these small pieces of codes, we can leave it untouched for now. Otherwise, there will be too many example codes. |
|
Okay. No problem! I will update soon. |
|
@dongjoon-hyun No need to rush, you can wait until I finish the round of reviewing. |
|
Oh, I see. Then, let me know when you finish. :) |
|
|
||
| package org.apache.spark.examples.mllib; | ||
|
|
||
| // $example on$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the import block in this way:
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
// $example on$
import scala.Tuple2;
import org.apache.spark.api.java.JavaDoubleRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.function.Function;
import org.apache.spark.mllib.linalg.Vectors;
import org.apache.spark.mllib.regression.LabeledPoint;
import org.apache.spark.mllib.regression.LinearRegressionModel;
import org.apache.spark.mllib.regression.LinearRegressionWithSGD;
// $example off$| from pyspark.mllib.classification import SVMWithSGD, SVMModel | ||
| from pyspark.mllib.regression import LabeledPoint | ||
| # $example off$ | ||
| from pyspark import SparkContext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be above of # $example on$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But other python codes keep from pyspark import SparkContext outside, doesn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah.. I see.
|
Test build #52040 has finished for PR 11320 at commit
|
| // $example on$ | ||
| import org.apache.spark.mllib.classification.{LogisticRegressionModel, LogisticRegressionWithLBFGS} | ||
| import org.apache.spark.mllib.evaluation.MulticlassMetrics | ||
| import org.apache.spark.mllib.linalg.Vectors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it
|
@dongjoon-hyun For the section of streaming linear regression: http://spark.apache.org/docs/latest/mllib-linear-methods.html#streaming-linear-regression, we should change the following sentence:
Substituting the bold words with |
| """ | ||
| from __future__ import print_function | ||
|
|
||
| import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the line to:
# $example on$
import sys
# $example off$
Since the truncated code uses the sys.argv[1].|
@dongjoon-hyun One more thing, try to make the output dirs different for different examples. Like there are 3 examples (Scala/Java/Python versions) use |
|
@dongjoon-hyun I finished the review. Thanks for working on this! |
|
Test build #52037 has finished for PR 11320 at commit
|
|
Thank you, @yinxusen ! |
|
I pushed the commit. |
|
Test build #52043 has finished for PR 11320 at commit
|
|
@mengxr LGTM Note that we consolidate the original streaming linear regression example from small pieces into a complete example and modify some sentences. |
|
Merged into master. Thanks! |
…sing include_example ## What changes were proposed in this pull request? This PR replaces example codes in `mllib-linear-methods.md` using `include_example` by doing the followings: * Extracts the example codes(Scala,Java,Python) as files in `example` module. * Merges some dialog-style examples into a single file. * Hide redundant codes in HTML for the consistency with other docs. ## How was the this patch tested? manual test. This PR can be tested by document generations, `SKIP_API=1 jekyll build`. Author: Dongjoon Hyun <[email protected]> Closes apache#11320 from dongjoon-hyun/SPARK-11381.
|
Hi, @mengxr . |
|
Hi, @mengxr . |
|
@dongjoon-hyun normally the Apache ASF bot closes the PRs automatically, but I don't know why this one was not closed. We actually can't close PRs. You would have to close it manually. |
What changes were proposed in this pull request?
This PR replaces example codes in
mllib-linear-methods.mdusinginclude_exampleby doing the followings:
examplemodule.How was the this patch tested?
manual test.
This PR can be tested by document generations,
SKIP_API=1 jekyll build.