Scikits机器学习中的价值缺失 [英] Missing values in scikits machine learning

查看:70
本文介绍了Scikits机器学习中的价值缺失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

scikit-learn中是否可能缺少值?应该如何代表他们?我找不到关于此的任何文档.

Is it possible to have missing values in scikit-learn ? How should they be represented? I couldn't find any documentation about that.

推荐答案

在scikit-learn中根本不支持缺少值.以前在邮件列表上已经对此进行了讨论,但是没有尝试实际编写代码来处理它们.

无论做什么,请勿使用NaN编码缺失值,因为许多算法拒绝处理包含NaN的样本.

Whatever you do, don't use NaN to encode missing values, since many of the algorithms refuse to handle samples containing NaNs.

以上答案已经过时;最新版本的scikit-learn具有类 Imputer 可以进行简单的按特征的缺失值估算.您可以向其提供包含NaN的数组,以将其替换为相应特征的均值,中位数或众数.

The above answer is outdated; the latest release of scikit-learn has a class Imputer that does simple, per-feature missing value imputation. You can feed it arrays containing NaNs to have those replaced by the mean, median or mode of the corresponding feature.

这篇关于Scikits机器学习中的价值缺失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆