首页 / 浏览问题 / 云GIS / 问题详情
iServer11.1.1机器学习中随机森林分类训练的问题
252EXP 2024年04月08日
如题,我使用iServer11.1.1对数据进行基于森林的分类训练

在设定完自变量和应变量后,运行了35秒左右返回分析失败,在log中发现以下错误:

java.lang.IllegalArgumentException: requirement failed: Classifier inferred 242 from label values in column rfc_1e6aa7c7c16d__labelCol, but this exceeded the max numClasses (100) allowed to be inferred from values.  To avoid this error for labels with > 100 classes, specify numClasses explicitly in the metadata; this can be done by applying StringIndexer to the label column.

进行预测的结果总共有16种,分别是:

0.50
0.75
1.00
5
9
13
17
21
29
37
45
61
81
121
161
241

这个问题我把预测结果批量修改成1~16后才模型终于可以分析成功

请问基于森林的分类训练是否只能预测100以下的数字?

1个回答

看报错提示是此意思,16种的类别值,把超过100的都调为100以内就可以正常对吧。
1,430EXP 2024年04月08日
对的。

也就是说这是式样?
是的,可以这样理解
好的,了解了。

我还想请问一下,我们的机器学习功能,选择解释字段(自变量)时,是否能选择字符型的变量,还是只能选择数字型的

支持string类型的字段。

感谢解答
您好,我用string字段尝试进行模型的训练,但是失败了。报错内容如下

org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 1894.0 failed 1 times, most recent failure: Lost task 0.0 in stage 1894.0 (TID 14422) (SMJ-DEV.supermapjp.local executor driver): org.apache.spark.SparkException: Failed to execute user defined function (VectorAssembler$$Lambda$3033/0x000000080162f040: (struct<二次メッシュと地形:double,四次メッシュと地形:double,一次メッシュ地形:double,地形と標高:double,五次メッシュと地形:double,三次メッシュと地形:double>) => struct<type:tinyint,size:int,indices:array<int>,values:array<double>>)

看起来他默认想把这些string字段转换成double然后报错了,这也是iServer机器学习的式样吗
和研发确认了,文档手册写的string类型是指参数字段名称是string,但实际要求字段的值要double类型。
了解了,感谢解答
...