当我想做机器学习项目时,我想将我的输入扩展到(0,1)
我使用sklearn函数来实现这一点,比如StandScaler()
但我发现,一旦我的数据包含nan,fit_transform()将失败,如下所示:
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
但我认为有某种需要,希望保留nan,并在其他非nan数据中进行标准缩放
为什么我们不支持这一点?有什么方法可以使用它吗
Tags:
最可能的情况是,您使用的是旧版(即0.20之前的版本)的scikit learn。该问题确实在v0.20中得到解决;从change log开始:
另请参见已关闭的Github问题#10404和相应的合并请求#11206
因此,只要将您的scikit learn升级到最新版本,您就可以了,也就是说,在这样的预处理过程中,NaN值确实会被忽略
相关问题 更多 >
编程相关推荐