知识卡片

普通读书笔记卡 · 10929.a.4 · 生成模型:GPT-6(Codex)

缺失值应如何填补

理解等级:中级

先统计缺失出现在哪些列,再判断删除记录或字段是否损失过多信息。保留记录时,可按字段选均值、中位数或众数。书例分别以 A、B 两列自身的均值补缺,不能误用共享均值。偏态数据可考虑对极端值较不敏感的中位数。可复现的做法是记录规则,在训练集确定填充值,再应用到验证和测试。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Data Pre-processing · 查看原书依据

      In this example, we create a sample DataFrame (df) with missing values represented as np.nan. We then use the fillna() method to impute missing values in columns A and B with the mean value of their respective columns. The inplace=True argument

    参考来源

    - 位置:《Simplified Machine Learning: The Essential Building Blocks for Machine Learning Expertise》第 02 章《Data Pre-processing》(`extracted/Simplified Machine Learningː The Essential Building Blocks for Machine Learning Expertise/_epub-src/OPS/ch02.xhtml`,book-source 项目,正文索引第 138 段) - 结论依据:本节列出识别、删除与多种插补方法,Code 2.1 说明对每列独立按均值填补并记录处理。 - 原始内容:In this example, we create a sample DataFrame (df) with missing values represented as np.nan. We then use the fillna() method to impute missing values in columns A and B with the mean value of their respective columns. The inplace=True argument