categoricalFeaturesInfo

categoricalFeaturesInfo

如何在pyspark randomForests中指定categoricalFeaturesInfo?

文档不是很清楚,我尝试了一些类似的方法:

categoricalFeaturesInfo = {(12,4)}

categoricalFeaturesInfo = {(12-> 4)}

categoricalFeaturesInfo = {Map [int,int](12,4)}

...等等,但它们都不起作用。任何帮助是极大的赞赏。

最佳答案

从python文档中,我们有:

categoricalFeaturesInfo: Map storing arity of categorical
             features.  E.g., an entry (n -> k) indicates that
             feature n is categorical with k categories indexed
             from 0: {0, 1, ..., k-1}.


尝试使用:

categoricalFeaturesInfo = {12:4}

08-20 00:09