gpt4 book ai didi

apache-spark - pyspark---randomForests 使用 "categoricalFeaturesInfo"指定分类变量

转载 作者:行者123 更新时间:2023-12-04 04:51:22 24 4
gpt4 key购买 nike

如何在 pyspark randomForests 中指定 categoricalFeaturesInfo?

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

分类特征信息= {(12,4)}

分类特征信息= {(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}

关于apache-spark - pyspark---randomForests 使用 "categoricalFeaturesInfo"指定分类变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29718945/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com