Github user selvinsource commented on the pull request:

    https://github.com/apache/spark/pull/7842#issuecomment-137924965
  
    As explained in details above, the order should be the same as the input 
vector (used for training the model).
    
    If you look at 
https://github.com/selvinsource/spark-pmml-exporter-validator/blob/decision_trees_validator/src/main/resources/spark_shell_exporter/decisiontree_breastcancerwisconsin.scala
    we take the first 9 values from the file as input vector:
    ```val data = 
sc.textFile("../datasets/breastcancerwisconsin_binaryclassification.csv")
    val parsedData = data.map { line =>
      val parts = line.split(',')
      LabeledPoint(parts.last.toDouble, 
Vectors.dense(parts.take(9).map(_.toDouble)))
    }```
    
    after building the moded, the prediction uses the same number of fields and 
order of the input vector (5,1,1,1,2,1,3,1,1):
    ```val model = DecisionTree.trainClassifier(parsedData, numClasses, 
categoricalFeaturesInfo,
      impurity, maxDepth, maxBins)
    var predictedValue = model.predict(Vectors.dense(5,1,1,1,2,1,3,1,1))```
    
    So it would be nice if the exported tree listed the fields in the same 
order of the input vector.
    
    As I said it is not a big deal, but it would be nice to have.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to