You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "David Hodeffi (JIRA)" <ji...@apache.org> on 2018/01/14 15:48:00 UTC
[jira] [Created] (SPARK-23071) spark ML print decision tree is not
readable.
David Hodeffi created SPARK-23071:
-------------------------------------
Summary: spark ML print decision tree is not readable.
Key: SPARK-23071
URL: https://issues.apache.org/jira/browse/SPARK-23071
Project: Spark
Issue Type: Improvement
Components: MLlib
Affects Versions: 2.2.1
Environment: Spark local[4], windows 7.
Reporter: David Hodeffi
I have dataset which was created from dataframe using VectorAssembler, the dataframe is a transformation of StringIndexer() for multiple columns I trained my model :
val assembler = new VectorAssembler().....
val data = assembler.transform(...)
val featureIndexer = new VectorIndexer()
val gbt = new GBTRegressor()
.setLabelCol("label")
.setFeaturesCol("indexedFeatures")
.setMaxIter(10)
val pipeline = new Pipeline()
.setStages(Array(featureIndexer, gbt))
val model = pipeline.fit(trainingData)
When I print my model it would look something like:
GBTRegressionModel (uid=gbtr_24b22b08fa90) with 10 trees
Tree 0 (weight 1.0):
If (feature 16 <= 0.22222222222222224)
If (feature 16 <= 0.13333333333333333)
If (feature 16 <= 0.07142857142857144)
If (feature 16 <= 0.02222222222222222)....
My first problem is that I would expect to see feature name and not feature index when printing the model, how can I resolve that? Another problem is caused because I used StringIndexer(), which means I would see the mapping of each value as int and not his string value. How can I print the model with the StringType column instead of the one was transformed with StringIndexer()?
Thanks for helpers
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org