sklearn中TypeError: reduction operation argmax not allowed for this dtype idmax报错解决方案
在网上学习的时候遇到了这个问题

造成如上报错的原因,可能是参数类型不支持,如对象是NAN时就会报错。
解决方法是对对象进行类型转换:
best_c=results_table.loc[results_table[‘Mean recall score’].astype(float).idxmax()][‘C_parameter’]
将上述NAN值转换成float类型,即可解决报错问题。

本文介绍了解决sklearn中出现TypeError: reduction operation 'argmax' not allowed for this dtype问题的方法。错误通常由不支持的操作引起,例如对象包含NAN值。通过将数据类型转换为float可以避免这一问题。
2922

被折叠的 条评论
为什么被折叠?



