Using CategoricalFeaturesInfo with DecisionTreeClassifier method in Spark

后端 未结 1 1099

I have to use this code:

val dt = new DecisionTreeClassifier().setLabelCol(\"indexedLabel\").setFeaturesCol(\"indexed         


        
相关标签:
1条回答
  • 2021-01-26 17:57

    You're mixing two different APIs which take different approach to categorical data:

    • RDD based o.a.s.mllib which provides required metadata by passing categoricalFeaturesInfo map.
    • Dataset (DataFrame) o.a.s.ml which is using column metadata to determine variable types. If you correctly use ML transformers to create features this should be handled automatically for you, otherwise you'll have to provide metadata manually.
    0 讨论(0)
提交回复
热议问题