请解释:KMeans does not accept missing values encoded as NaN natively. For supervised learning, you might want to consider sklearn.ensemble.HistGradientBoostingClassifier and Regressor which accept missing values encoded as NaNs natively. Alternatively, it is possible to preprocess the data, for instance by using an imputer transformer in a pipeline or drop samples with missing values. See https://scikit-learn.org/stable/modules/impute.html You can find a list of all estimators that handle NaN values at the following page: https://scikit-learn.org/stable/modules/impute.html#estimators-that-handle-nan-values
时间: 2023-06-04 07:06:07 浏览: 1615
KMeans 是一种无监督学习算法,它不能原生地处理缺失值。对于有监督学习问题,建议使用能够处理缺失值的算法,例如 sklearn.ensemble.HistGradientBoostingClassifier 和 Regressor。另一种处理方法是对数据进行预处理,例如使用 imputer transformer 进行填充,或将具有缺失值的样本删除。有关更多信息,请参见https://scikit-learn.org/stable/modules/impute.html。您可以在以下页面中找到处理 NaN 值的所有估算器的列表:https://scikit-learn.org/stable/modules/impute.html。
阅读全文