Machine Learning Done Wrong(机器学习七种易犯的错误)

Azure ML AI交付流水线:从模型注册到在线端点的生产实践 机器学习模型部署不是简单打包上线,而是涵盖模型管理、环境一致性、推理服务化、流量治理与可观测性的全生命周期工程。其核心在于将非算法工作(如版本控制、依赖锁定、弹性扩缩、灰度发布)标准化、声明式化和自动化。Azure Machine Learning 通过 Model Registry 实现模型元数据与版本可追溯,借助 Managed Online Endpoint 和 Traffic Routing 支持安全灰度与秒级回滚,结合 Inference Cluster 提供确定性SLA保障。这些能力共同构成一条 阅读详情

作者总结了机器学习七种易犯的错误:

1.想当然用缺省Loss;

2.非线性情况下用线性模型;

3.忘记Outlier;

4.样本少时用High Viriance模型;

5.不做标准化就用L1/L2等正则;

6.不考虑线性相关直接用线性模型;

7.LR模型中用参数绝对值判断feature重要性。

Statistical modeling is a lot like engineering.

In engineering, there are various ways to build a key-value storage, and each design makes a different set of assumptions about the usage pattern. In statistical modeling, there are various algorithms to build a classifier, and each algorithm makes a different set of assumptions about the data.

When dealing with small amounts of data, it’s reasonable to try as many algorithms as possible and to pick the best one since the cost of experimentation is low. But as we hit “big data”, it pays off to analyze the data upfront and then design the modeling pipeline (pre-processing, modeling, optimization algorithm, evaluation, productionization) accordingly.

As pointed out in my previous post, there are dozens of ways to solve a given modeling problem. Each model assumes something different, and it’s not obvious how to navigate and identify which assumptions are reasonable. In industry, most practitioners pick the modeling algorithm they are most familiar with rather than pick the one which best suits the data. In this post, I would like to share some common mistakes (the don't-s). I’ll save some of the best practices (the do-s) in a future post.

1. Take default loss function for granted

Many practitioners train and pick the best model using the default loss function (e.g., squared error). In practice, off-the-shelf loss function rarely aligns with the business objective. Take fraud detection as an example. When trying to detect fraudulent transactions, the business objective is to minimize the fraud loss. The off-the-shelf loss function of binary classifiers weighs false positives and false negatives equally. To align with the business objective, the loss function should not only penalize false negatives more than false positives, but also penalize each false negative in proportion to the dollar amount. Also, data sets in fraud detection usually contain highly imbalanced labels. In these cases, bias the loss function in favor of the rare case (e.g., through up/down sampling).

2. Use plain linear models for non-linear interaction

When building a binary classifier, many practitioners immediately jump to logistic regression because it’s simple. But, many also forget that logistic regression is a linear model and the non-linear interaction among predictors need to be encoded manually. Returning to fraud detection, high order interaction features like "billing address = shipping address and transaction amount < $50" are required for good model performance. So one should prefer non-linear models like SVM with kernel or tree based classifiers that bake in higher-order interaction features.

3. Forget about outliers

Outliers are interesting. Depending on the context, they either deserve special attention or should be completely ignored. Take the example of revenue forecasting. If unusual spikes of revenue are observed, it's probably a good idea to pay extra attention to them and figure out what caused the spike. But if the outliers are due to mechanical error, measurement error or anything else that’s not generalizable, it’s a good idea to filter out these outliers before feeding the data to the modeling algorithm.

Some models are more sensitive to outliers than others. For instance, AdaBoost might treat those outliers as "hard" cases and put tremendous weights on outliers while decision tree might simply count each outlier as one false classification. If the data set contains a fair amount of outliers, it's important to either use modeling algorithm robust against outliers or filter the outliers out.

4. Use high variance model when n<<p

SVM is one of the most popular off-the-shelf modeling algorithms and one of its most powerful features is the ability to fit the model with different kernels. SVM kernels can be thought of as a way to automatically combine existing features to form a richer feature space. Since this power feature comes almost for free, most practitioners by default use kernel when training a SVM model. However, when the data has n<<p (number of samples << number of features) --  common in industries like medical data -- the richer feature space implies a much higher risk to overfit the data. In fact, high variance models should be avoided entirely when n<<p.

5. L1/L2/... regularization without standardization

Applying L1 or L2 to penalize large coefficients is a common way to regularize linear or logistic regression. However, many practitioners are not aware of the importance of standardizing features before applying those regularization.

Returning to fraud detection, imagine a linear regression model with a transaction amount feature. Without regularization, if the unit of transaction amount is in dollars, the fitted coefficient is going to be around 100 times larger than the fitted coefficient if the unit were in cents. With regularization, as the L1 / L2 penalize larger coefficient more, the transaction amount will get penalized more if the unit is in dollars. Hence, the regularization is biased and tend to penalize features in smaller scales. To mitigate the problem, standardize all the features and put them on equal footing as a preprocessing step.

6. Use linear model without considering multi-collinear predictors

Imagine building a linear model with two variables X1 and X2 and suppose the ground truth model is Y=X1+X2. Ideally, if the data is observed with small amount of noise, the linear regression solution would recover the ground truth. However, if X1 and X2 are collinear, to most of the optimization algorithms' concerns, Y=2*X1, Y=3*X1-X2 or Y=100*X1-99*X2 are all as good. The problem might not be detrimental as it doesn't bias the estimation. However, it does make the problem ill-conditioned and make the coefficient weight uninterpretable.

7. Interpreting absolute value of coefficients from linear or logistic regression as feature importance

Because many off-the-shelf linear regressor returns p-value for each coefficient, many practitioners believe that for linear models, the bigger the absolute value of the coefficient, the more important the corresponding feature is. This is rarely true as (a) changing the scale of the variable changes the absolute value of the coefficient (b) if features are multi-collinear, coefficients can shift from one feature to others. Also, the more features the data set has, the more likely the features are multi-collinear and the less reliable to interpret the feature importance by coefficients.

So there you go: 7 common mistakes when doing ML in practice. This list is not meant to be exhaustive but merely to provoke the reader to consider modeling assumptions that may not be applicable to the data at hand. To achieve the best model performance, it is important to pick the modeling algorithm that makes the most fitting assumptions -- not just the one you’re most familiar with.

机器学习错误分析:从模糊不准到精准诊断的工程化方法 错误分析是机器学习模型落地前的关键临床诊断环节,其本质是将笼统的‘模型不准’转化为可归因、可量化、可行动的子场景失效定位。它基于混淆矩阵、错误率(ER)、数据占比(DF)与改进空间(RFI)等核心指标,揭示泛化黑洞、代价不对称与优化路径迷失三大现实问题。相比整体准确率,RFI矩阵能客观衡量方言口音、低光照图像等长尾场景的真实业务影响,驱动数据增强、标注校准与模型微调等精准改进。本文聚焦Error Analysis for Machine learning models的工程实践,提供从手工标注表设计、根因验 阅读详情

相关推荐

2020年高价值机器学习博客清单:面向工程实践的技术选型指南

机器学习博客是连接学术前沿与工业落地的关键桥梁,其核心价值在于将抽象理论转化为可调试、可监控、可上线的工程实践。理解博客的技术定位,需从信息过滤效率、问题解决密度和跨框架迁移能力三方面切入——它不仅是知识载体,更是工程师应对模型掉点、框架升级、A/B测试偏差等真实场景的决策依据。尤其在技术选型阶段,优质博客能帮助团队规避‘论文炫技’陷阱,聚焦可复现的代码细节、可验证的超参配置与可审计的伦理约束。本文基于2020年一线实践,系统梳理Distill.pub、The Gradient等七家高信噪比博客的不可替代性

weixin_30787531的博客 361

机器学习模型评价(Evaluating Machine Learning Models)-主要概念与陷阱

机器学习模型评价(Evaluating Machine Learning Models)-主要概念与陷阱   本文主要解释一些关于机器学习模型评价的主要概念,与评价中可能会遇到的一些陷阱。如训练集-验证集二划分校验(Hold-out validation)、交叉校验(Cross-validation)、超参数调优(hyperparameter tuning)等。这三个术语都是从不同的层

我和我追逐的梦~~~ 9万+

端到端机器学习落地实战:从Notebook到高可用API的12道生死关卡

端到端机器学习(End-to-End ML)指模型从开发、训练、评估到生产部署与持续监控的全生命周期闭环。其核心原理在于打破算法、工程与运维的协作壁垒,通过分层架构(数据层/特征层/模型层/服务层/观测层)、标准化契约(如ONNX格式、JSON Schema、健康探针)和自动化质量门禁,构建可复现、可审计、可回滚的韧性系统。技术价值体现在显著缩短故障定位时间(从小时级降至分钟级)、提升模型上线成功率、保障服务SLA(如P95延迟≤180ms、错误率<0.05%)。典型应用场景包括电商实时推荐、金融反欺诈、工

abo1977的博客 445

01_the_machine_learning_landscape

1. How would you define Machine Learning? Ans: Machine Learning is about building systems that can learn from data. Learning means getting better at some task, given some performance measure. ...

Linli522362242的专栏 836

AdaBoost原始论文精读:弱可学习性、指数损失与分布重加权原理

AdaBoost是一种将弱学习器提升为强分类器的集成学习框架,其核心在于‘弱可学习性’假设——基模型只需略优于随机猜测(错误率<0.5),即可通过迭代加权构建高精度模型。该算法本质是前向分步加法模型在指数损失函数下的精确实现,每轮通过分布重加权机制强化难例学习,权重更新公式直接导出自损失最小化。其理论价值在于建立了‘弱可学习’到‘强可学习’的严格等价性,技术优势体现在可解释性强、无需调参即具收敛保证;广泛应用于信用评分、异常检测等对误报敏感的二分类场景。本文深入解析1997年Freund与Schapire原

weixin_30596165的博客 404

Agentic AI架构革命:从M1到M2的范式迁移

机器学习系统由Learning(模型训练)和Machine(工程架构)两大支柱构成。随着大语言模型(LLM)在企业级应用中暴露随机性和高运维成本等问题,Agentic AI架构正经历从M1到M2的范式迁移。M1聚焦模型训练基础设施,而M2创新性地实现了业务价值流闭环、联邦式执行和边缘智能部署。这种架构演进在金融交易、医疗诊断等场景展现出显著优势,如决策延迟降低15倍、合规通过率提升35%。通过混合决策机制和内存优化等关键技术,策略型智能体正在重塑AI工程实践,为企业级AI部署提供可靠解决方案。

diaoju3333的博客 632

Machine Learning Done Wrong【转】

1. Take default loss function for granted Many practitioners train and pick the best model using the default loss function (e.g., squared error). In practice, off-the-shelf loss function rarely align...

weixin_33709364的博客 143

实战解析:在.NET中实现Dify API流式请求与响应的完整方案

本文详细解析了在.NET应用中对接Dify API时实现流式请求与响应的完整方案。针对传统后端“接收完才返回”的痛点,文章提供了基于ASP.NET Core的实战代码,通过配置HttpCompletionOption.ResponseHeadersRead和手动Flush响应流,构建高效的中转管道,确保AI回复能够像ChatGPT一样实时逐字推送到前端,显著提升用户体验。

weixin_29267307的博客 296

Machine Learning(吴恩达<六>异常检测和推荐系统)

问题动机 异常检测问题的具体描述 对于一个对于x建立的概率模型,如果一个新的测试数据小于某个阈值,就将其标记为异常;大于这个阈值,则认为是正常的。 异常检测举例 一些应用案例,最常见的:欺诈检测;另一个例子:工业生产领域、监测计算机可能出现的异常。 高斯分布 没错就是概率论里面学的正态分布。 参数估计问题 构建异常检测算法 一个共有m个无标签训练集,训练集里每个样本是一个R^n维的特征向量。 处理异常检测的方法是,用数据集建立起概率模型p(x),试图解决出那些特.....

qq_54809548的博客 1200

深入解析AutoConfigURL劫持:从注册表权限到一键修复

本文深入解析了AutoConfigURL劫持的原理,揭示其通过篡改注册表权限锁定浏览器设置的机制。文章提供了从手动修复注册表权限到使用一键修复工具的详细解决方案,并指导用户进行DNS检查与病毒查杀,以彻底根除此类顽固劫持问题。

weixin_29229989的博客 765

ST7789P3初始化配置

【代码】ST7789P3初始化配置。

zqq_1314的博客 4145

Machine Learning笔记——回归模型(二)

利用scikit-learn做线性回归 沿用上次房价数据中的RM(房间数)和MEDV(房价),使用scikit-learn库中的LinearRegression()来做线性回归。 import os import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn.linear_model ...

After__today的博客 768

保姆级教程:在Ubuntu 20.04上搞定PX4飞控与T265的视觉定位(附避坑指南)

本文提供在Ubuntu 20.04上配置PX4飞控与T265视觉定位系统的详细教程,涵盖驱动安装、ROS与MAVROS桥接、PX4参数调优及故障排查。通过实测验证的步骤和避坑指南,帮助开发者实现厘米级精度的视觉定位,特别适合室内无人机应用。

weixin_29038155的博客 248

【Machine Learning Done Wrong】机器学习七种易犯的错误

【Machine Learning Done Wrong】http://t.cn/RvIHN3N 作者总结了机器学习七种易犯的错误:1.想当然用缺省Loss;2.非线性情况下用线性模型;3.忘记Outlier;4.样本少时用High Viriance模型;5.不做标准化就用L1/L2等正则;6.不考虑线性相关直接用线性模型;7.LR模型中用参数绝对值判断feature重要性。

pinyangtenglong的专栏 682

大开眼界的十大开源人工智能项目

这是一个强大的开源工具,能让你在不同框架之间自由切换,无需重写代码。它是一个开源工具,能用简单的SQL语言同时处理数据和AI模型,让一切变得有序而高效。Rasa是我开发智能聊天机器人时的首选,它让你轻松掌控机器人对话的每个细节。我经常用它快速验证模型在不同框架下的表现,省去了大量烦躁的调试过程。最近发现的Vapi是一个以API方式提供的语音AI工具,开发者友好程度超乎想象。KNIME是一个以拖拽方式构建数据分析流程的开源工具,仿佛是数据界的乐高积木。它像个忠诚的守门员,确保你的模型始终健康运行。

wjianwei666的专栏 1103

On the convergence of FedAvg on non-iid data

On the convergence of FedAvg on non-iid data

Lyn_S的博客 7078

Machine Learning Done Wrong

Statistical modeling is a lot like engineering. In engineering, there are various ways to build a key-value storage, and each design makes a different set of assumptions about the usage pattern. In

pzy20062141的专栏 418

点云焊缝提取

本文介绍了一个基于PCL库的点云处理流程,包含三个核心模块:MLS平滑处理通过多项式拟合修正点云位置;差异提取通过双向匹配定位源/目标点云的非重叠区域;统计过滤剔除离群噪声点。该流程采用"平滑-筛选-净化"的通用思路,将复杂算法封装为可配置接口,实现了工业级点云预处理。文章重点分析了各模块的原理、PCL接口调用及参数设计逻辑,同时指出参数调优、算法扩展等深入探索方向,展现了PCL在点云处理中的模块化优势与实用价值。

weixin_45196569的博客 249

读《Machine Learning Done Wrong》(机器学习易犯错误)有感

首先在“我爱机器学习”微博上看到的,地址是http://www.52ml.net/15845.html

wait1112的专栏 793

强化学习从基础到进阶-案例与实践[4]:深度Q网络-DQN、double DQN、经验回放、rainbow、分布式DQN

强化学习从基础到进阶-案例与实践[4]:深度Q网络-DQN、double DQN、经验回放、rainbow、分布式DQN

丨汀、的博客 2065

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

Flask+Heroku机器学习端到端部署实战:从训练到API上线

机器学习模型服务化是数据科学落地的关键环节,其本质是将离线训练成果转化为可被业务系统调用的HTTP接口。核心原理在于Web框架封装模型推理逻辑,通过RESTful API接收结构化输入、执行预测并返回标准化响应。技术价值体现在降低协作门槛、加速验证闭环、支撑轻量级业务决策。典型应用场景包括内部运营工具、销售辅助系统、客户风险初筛等对延迟和并发要求不高的MVP阶段。本文聚焦Flask轻量Web框架与Heroku免运维云平台的组合实践,覆盖数据加载、LogisticRegression模型训练、pkl序列化、P

张沈鹏,在路上 ... 381

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

生产级机器学习:从Notebook到真实业务系统的系统性工程

机器学习模型部署不是算法落地的终点,而是系统性工程的起点。在金融等强监管场景中,模型本质上是嵌入业务流水线的‘可问责服务组件’,其健康度由数据时效性、特征稳定性、服务韧性、合规可审计性共同定义。本文聚焦生产ML的核心挑战——集成失败远多于建模失败、漂移不可消除但必须可感知、优雅降级需契约化而非代码化。通过数据血缘治理、契约接口设计、双通道灰度、特征快照、决策水印与四象限监控等实战方法,构建具备可观测性、可追溯性与可干预能力的可信ML系统,真正实现模型在真实世界中的稳定呼吸。

weixin_34109408的博客 347

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

AWS AI基础设施升级实战指南:从Graviton3到Trainium的工程落地

AI基础设施正从‘能跑通’迈向‘可量产’,核心在于算力选型、编译优化与服务化部署的协同演进。ARM架构CPU(如Graviton3)凭借INT8/FP16深度优化,在量化推理场景实现3倍延迟下降;专用训练芯片(如Trainium)通过零拷贝梯度同步重构分布式训练效率。技术价值不仅体现为性能提升,更在于TCO降低、运维简化与非专家建模门槛下移。典型应用场景覆盖电商推荐实时推理、医疗影像标注加速、BI预测模块弹性服务等。本文基于17个PoC实测,聚焦硬件兼容性、SDK适配约束与冷启动边界等真实工程卡点,提供可立

chuanggangbo5551的博客 400

使用机器学习算法预测时间序列时注意落入陷阱

Data Scientist, AI/Machine Learning &amp; Advanced Analytics at Kongsberg Digital Time series forecasting is an important area of machine learning. It is important because there are so many predictio...

Andrew_jdw的博客 1785

机器学习分类指标完全手册:从混淆矩阵到 F1 / ROC / PR(9000字深度解析·附 16 段 Python 代码)

9000字深度解析机器学习 7 大分类指标:Accuracy、Precision、Recall、F1、ROC-AUC、PR-AUC、LogLoss。涵盖混淆矩阵、多分类 Macro/Micro/Weighted 体系、类别不平衡 5 大方案、阈值调优技巧。配 6 张原创可视化图 + 10 张对比表 + 16 段 sklearn/matplotlib 可运行代码,解决「99% Accuracy 模型毫无用处」的指标骗局问题。

热爱技术与前沿创新,深耕科技领域,在科创中精进自我;探索技术乐趣,分享技术干货与成长心得,以技术为伴,热爱生活,在科创与生活中双向成长。 440

语音识别评估指南:WER与CER指标详解及实战优化

在语音识别技术中,准确率是衡量系统性能的核心。其评估通常基于编辑距离这一基础算法概念,通过动态规划计算最小编辑操作次数。词错率和字错率作为关键量化指标,分别以词和字为单位,为模型优化提供方向。理解这些指标的技术价值在于,它们能帮助开发者定位声学模型或语言模型的问题,例如替换错误高可能源于音素混淆。在实际应用场景中,针对中文等语言,字错率因分词无关性更稳定;而英文场景则常用词错率。通过分析错误类型,可指导数据增强、模型调优等工程实践,最终提升智能助手、会议转录等产品的用户体验。

354
上一篇: 寻路推荐(理念篇)
下一篇: 机器学习 实用技巧
overstack
博客等级 码龄14年 115粉丝 55原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值