Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

keypointt
Copy link
Contributor

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

@mengxr
Copy link
Contributor

mengxr commented Feb 11, 2016

ok to test

@mengxr
Copy link
Contributor

mengxr commented Feb 11, 2016

cc @yinxusen

@mengxr
Copy link
Contributor

mengxr commented Feb 11, 2016

@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!

@yinxusen
Copy link
Contributor

retest it please


def main(args: Array[String]) {

val conf = new SparkConf().setAppName("PMMLModelExportExample").setMaster("local[*]")
Copy link
Contributor

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.

Copy link
Contributor Author

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

@SparkQA
Copy link

SparkQA commented Feb 14, 2016

Test build #51254 has finished for PR 11126 at commit 5315350.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yinxusen
Copy link
Contributor

@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:

screen shot 2016-02-13 at 7 33 28 pm

@SparkQA
Copy link

SparkQA commented Feb 14, 2016

Test build #51256 has finished for PR 11126 at commit 8da72d2.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Feb 14, 2016

Test build #51263 has finished for PR 11126 at commit bb6329a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yinxusen
Copy link
Contributor

@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.
Copy link
Contributor

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

Copy link
Contributor

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.

@mengxr
Copy link
Contributor

mengxr commented Feb 16, 2016

Merged into master. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants