Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6219#discussion_r30475055
  
    --- Diff: docs/mllib-pmml-model-export.md ---
    @@ -0,0 +1,86 @@
    +---
    +layout: global
    +title: PMML model export - MLlib
    +displayTitle: <a href="mllib-guide.html">MLlib</a> - PMML model export
    +---
    +
    +* Table of contents
    +{:toc}
    +
    +## MLlib supported models
    +
    +MLlib supports model export to Predictive Model Markup Language 
([PMML](http://en.wikipedia.org/wiki/Predictive_Model_Markup_Language)).
    +
    +The table below outlines the MLlib models that can be exported to PMML and 
their equivalent PMML model.
    +
    +<table class="table">
    +  <thead>
    +    <tr><th>MLlib model</th><th>PMML model</th></tr>
    +  </thead>
    +  <tbody>
    +    <tr>
    +      <td>KMeansModel</td><td>ClusteringModel</td>
    +    </tr>    
    +    <tr>
    +      <td>LinearRegressionModel</td><td>RegressionModel 
(functionName="regression")</td>
    +    </tr>
    +    <tr>
    +      <td>RidgeRegressionModel</td><td>RegressionModel 
(functionName="regression")</td>
    +    </tr>
    +    <tr>
    +      <td>LassoModel</td><td>RegressionModel 
(functionName="regression")</td>
    +    </tr>
    +    <tr>
    +      <td>SVMModel</td><td>RegressionModel (functionName="classification" 
normalizationMethod="none")</td>
    +    </tr>
    +    <tr>
    +      <td>Binary LogisticRegressionModel</td><td>RegressionModel 
(functionName="classification" normalizationMethod="logit")</td>
    +    </tr>
    +  </tbody>
    +</table>
    +
    +## Examples
    +<div class="codetabs">
    +
    +<div data-lang="scala" markdown="1">
    +To export a supported `model` (see table above) to PMML, simply call 
`model.toPMML`.
    +
    +Here a complete example of building a KMeansModel and print it out in PMML 
format:
    +{% highlight scala %}
    +import org.apache.spark.mllib.clustering.KMeans
    +import org.apache.spark.mllib.linalg.Vectors
    +
    +// Load and parse the data
    +val data = sc.textFile("data/mllib/kmeans_data.txt")
    +val parsedData = data.map(s => Vectors.dense(s.split(' 
').map(_.toDouble))).cache()
    +
    +// Cluster the data into two classes using KMeans
    +val numClusters = 2
    +val numIterations = 20
    +val clusters = KMeans.train(parsedData, numClusters, numIterations)
    +
    +// Export to PMML
    +println("PMML export = " + clusters.toPMML)
    --- End diff --
    
    Remove `"PMML export = " + ` or change it to `PMML Model:\n". It is hard to 
think of a use case that mixes some strings with the XML content in the same 
line.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to