-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
[SPARK-13018][Docs] Replace example code in mllib-pmml-model-export.md using include_example #11126
Conversation
ok to test |
cc @yinxusen |
@keypointt @yinxusen Could you start from this PR first and then other longer ones? @keypointt is new to Spark development. Starting from small ones could avoid unnecessary code rewrites. Thanks! |
retest it please |
|
||
def main(args: Array[String]) { | ||
|
||
val conf = new SparkConf().setAppName("PMMLModelExportExample").setMaster("local[*]") |
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.
Don't set master here.
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.
ok, I've set master in other tickets besides this one, and also def main(args: Array[String]): Unit
Test build #51254 has finished for PR 11126 at commit
|
@keypointt I recommend adding the following code to the example, too. Then delete previous code from line 55-67. Meanwhile, we should move the line 53 ahead and rephrase it. // Export the model to a String in PMML format
clusters.toPMML
// Export the model to a local file in PMML format
clusters.toPMML("/tmp/kmeans.xml")
// Export the model to a directory on a distributed file system in PMML format
clusters.toPMML(sc,"/tmp/kmeans")
// Export the model to the OutputStream in PMML format
clusters.toPMML(System.out) @mengxr If we don't use #9430, I suggest to add those code together into a single file and rephrase those lines among those code snippets. Otherwise we get the following result: |
Test build #51256 has finished for PR 11126 at commit
|
Test build #51263 has finished for PR 11126 at commit
|
@mengxr LGTM |
@@ -45,41 +45,12 @@ The table below outlines the `spark.mllib` models that can be exported to PMML a | |||
<div data-lang="scala" markdown="1"> | |||
To export a supported `model` (see table above) to PMML, simply call `model.toPMML`. | |||
|
|||
As well as exporting the PMML model to a String (`model.toPMML` as in the example above), you can export the PMML model to other formats. |
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.
minor: please wrap lines at 100 chars
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.
Let's wrap it next time.
Merged into master. Thanks! |
Replace example code in mllib-pmml-model-export.md using include_example
https://issues.apache.org/jira/browse/SPARK-13018
The example code in the user guide is embedded in the markdown and hence it is not easy to test. It would be nice to automatically test them. This JIRA is to discuss options to automate example code testing and see what we can do in Spark 1.6.
Goal is to move actual example code to spark/examples and test compilation in Jenkins builds. Then in the markdown, we can reference part of the code to show in the user guide. This requires adding a Jekyll tag that is similar to https://github.com/jekyll/jekyll/blob/master/lib/jekyll/tags/include.rb, e.g., called include_example.
{% include_example scala/org/apache/spark/examples/mllib/PMMLModelExportExample.scala %}
Jekyll will find
examples/src/main/scala/org/apache/spark/examples/mllib/PMMLModelExportExample.scala
and pick code blocks marked "example" and replace code block in{% highlight %}
in the markdown.
See more sub-tasks in parent ticket: https://issues.apache.org/jira/browse/SPARK-11337