在机器学习中,你需要多少训练数据?

[机器学习] :到底需要多少数据?理论分析来告诉你 1. 前言 机器学习中最值得问的一个问题是,到底需要多少数据才可以得到一个较好的模型?从理论角度,有Probably approximately correct (PAC) learning theory来描述在何种情况下,可以得到一个近似正确的模型。但从实用角度看,PAC的使用范围还是比较局限的。 所以今天我们主要想讨论一个问题:到底如何定义有效数据量。 2.数据的粒度 数据的粒度可... 阅读详情

你为什么会问这个问题?

首先我们要搞清楚你为什么会问需要多大的训练数据集。

可能你现在有以下情况:

  • 你有太多的数据。可以考虑通过构建学习曲线(learning curves)来预估样本数据集(representative sample)的大小或者使用大数据的框架把所有的可得数据都用上。
  • 你有太少的数据。首先确定你的数据量确实比较少。那么可以考虑尝试收集更多的数据或者用数据增强的方法(data augmentation methods)来人为的增加数据样本大小
  • 你还没有开始收集数据?你需要开始手机数据并且评估这些数据是否足够。如果你是在做一个研究或者数据收集太昂贵,你可以和领域内的专家或者统计学家聊一聊。

在我自己实际工作中,我经常应用学习曲线,在小数据集上应用重新采样的方法(resampling methods)比如k-fold 交叉验证和bootstrap,和在最终结果中增加置信区间。

针对这个问题,你究竟需要多少训练数据?

1. 不能一概而论,需要分论讨论

No one can tell you how much data you need for your predictive modeling problem.没有人可以在不了解你的项目的情况下告诉你,你究竟需要多少训练数据。这个一个棘手的问题,你经常需要通过经验调查来得到答案

机器学习中你所需要的数据数量和很多因素有关,比如:

  • 你要解决问题的复杂程度, nominally the unknown underlying function that best relates your input variables to the output variable.
  • 学习算法的复杂程度, nominally the algorithm used to inductively learn the unknown underlying mapping function from specific examples.

.2. 通过学习别人的经验进行类比

很多人在你之前做了很多机器学习相关的研究,有些人还针对他们的研究发表了paper.也许你可以参考那些和你的问题相似的文章,借鉴别人需要多大的数据量。

你还可以研究他们关于数据量大小对算法表现的影响的文章。你可以在google, Google Scholar 和Arxiv上搜索文章

3. 用你的领域的专业知识

You need a sample of data from your problem that is representative of the problem you are trying to solve.

In general, the examples must be independent and identically distributed.

Remember, in machine learning we are learning a function to map input data to output data. The mapping function learned will only be as good as the data you provide it from which to learn.

This means that there needs to be enough data to reasonably capture the relationships that may exist both between input features and between input features and output features.

Use your domain knowledge, or find a domain expert and reason about the domain and the scale of data that may be required to reasonably capture the useful complexity in the problem.

4. 应用统计式启发

There are statistical heuristic methods available that allow you to calculate a suitable sample size.

Most of the heuristics I have seen have been for classification problems as a function of the number of classes, input features or model parameters. Some heuristics seem rigorous, others seem completely ad hoc.

Here are some examples you may consider:

  • Factor of the number of classes: There must be x independent examples for each class, where x could be tens, hundreds, or thousands (e.g. 5, 50, 500, 5000).
  • Factor of the number of input features: There must be x% more examples than there are input features, where x could be tens (e.g. 10).
  • Factor of the number of model parameters: There must be x independent examples for each parameter in the model, where x could be tens (e.g. 10).

They all look like ad hoc scaling factors to me.

Have you used any of these heuristics?
How did it go? Let me know in the comments.

In theoretical work on this topic (not my area of expertise!), a classifier (e.g. k-nearest neighbors) is often contrasted against the optimal Bayesian decision rule and the difficulty is characterized in the context of the curse of dimensionality; that is there is an exponential increase in difficulty of the problem as the number of input features is increased.

For example:

Findings suggest avoiding local methods (like k-nearest neighbors) for sparse samples from high dimensional problems (e.g. few samples and many input features).

For a kinder discussion of this topic, see:

5. 非线性算法一般需要更多数据

The more powerful machine learning algorithms are often referred to as nonlinear algorithms.

By definition, they are able to learn complex nonlinear relationships between input and output features. You may very well be using these types of algorithms or intend to use them.

These algorithms are often more flexible and even nonparametric (they can figure out how many parameters are required to model your problem in addition to the values of those parameters). They are also high-variance, meaning predictions vary based on the specific data used to train them. This added flexibility and power comes at the cost of requiring more training data, often a lot more data.

In fact, some nonlinear algorithms like deep learning methods can continue to improve in skill as you give them more data.

If a linear algorithm achieves good performance with hundreds of examples per class, you may need thousands of examples per class for a nonlinear algorithm, like random forest, or an artificial neural network.

6. 评估数据集大小和模型表现

It is common when developing a new machine learning algorithm to demonstrate and even explain the performance of the algorithm in response to the amount of data or problem complexity.

These studies may or may not be performed and published by the author of the algorithm, and may or may not exist for the algorithms or problem types that you are working with.

I would suggest performing your own study with your available data and a single well-performing algorithm, such as random forest.

Design a study that evaluates model skill versus the size of the training dataset.

Plotting the result as a line plot with training dataset size on the x-axis and model skill on the y-axis will give you an idea of how the size of the data affects the skill of the model on your specific problem.

This graph is called a learning curve.

From this graph, you may be able to project the amount of data that is required to develop a skillful model, or perhaps how little data you actually need before hitting an inflection point of diminishing returns.

I highly recommend this approach in general in order to develop robust models in the context of a well-rounded understanding of the problem.

7. 天真的猜测

You need lots of data when applying machine learning algorithms.

Often, you need more data than you may reasonably require in classical statistics.

I often answer the question of how much data is required with the flippant response:

Get and use as much data as you can.

If pressed with the question, and with zero knowledge of the specifics of your problem, I would say something naive like:

  • You need thousands of examples.
  • No fewer than hundreds.
  • Ideally, tens or hundreds of thousands for “average” modeling problems.
  • Millions or tens-of-millions for “hard” problems like those tackled by deep learning.

Again, this is just more ad hoc guesstimating, but it’s a starting point if you need it. So get started!

8. Get More Data (No Matter What!?)

Big data is often discussed along with machine learning, but you may not require big data to fit your predictive model.

Some problems require big data, all the data you have. For example, simple statistical machine translation:

If you are performing traditional predictive modeling, then there will likely be a point of diminishing returns in the training set size, and you should study your problems and your chosen model/s to see where that point is.

Keep in mind that machine learning is a process of induction. The model can only capture what it has seen. If your training data does not include edge cases, they will very likely not be supported by the model.

不要拖延,马上开始吧

不要让训练数据大小的问题阻止你开始你的研究你的模型问题。尽可能多的获得数据,把所有可用的资源都用上,验证模型在解决你的问题上是否有效.

Learn something, then take action to better understand what you have with further analysis, extend the data you have with augmentation, or gather more data from your domain.

延伸阅读

This section provides more resources on the topic if you are looking go deeper.

There is a lot of discussion around this question on Q&A sites like Quora, StackOverflow, and CrossValidated. Below are few choice examples that may help.

I expect that there are some great statistical studies on this question; here are a few I could find.

Other related articles.

If you know of more, please let me know in the comments below.

Summary

In this post, you discovered a suite of ways to think and reason about the problem of answering the common question:

How much training data do I need for machine learning?

Did any of these methods help?
Let me know in the comments below.

Do you have any questions?
Ask your questions in the comments below and I will do my best to answer.

Except, of course, the question of how much data that you specifically need

如果您有训练数据采集和标注需求欢迎联系我们www.sparkapi.ai

机器学习需要多少训练数据? 机器学习需要多少训练数据? 取决于: 所需解决问题的难易程度 所采用的模型的复杂程度(模型参数数量) 想要达到什么样的性能 ① 最快的方法 查找相关领域的论文资料,别人一般用多少的数据量 ② 经验范围 回归分析:要训练出一个性能良好的模型,所需训练样本数量应是模型参数数量的10倍。 缺点: 稀疏特征:例如稀疏特征的编码是01001001对于模型的训练能够起到作用的特征是少数的,而不起作用的特征占大多数。依照上述线性规则,若模型对于每个特征分配相应的参数,也就是说对于无用的特征也分配了. 阅读详情

相关推荐

【AI】用iOS的ML(机器学习)创建自己的AI App

在机器学习中,一切都始于模型,这是进行预测或识别的系统。教计算机学习涉及使用训练数据的机器学习算法进行学习。从训练中生成的输出通常称为机器学习模型。有不同类型的机器学习模型来解决同一个问题(例如对象识别),但使用不同的算法。是其中一些机器学习算法。

欧阳天涵的专栏 5841

机器学习需要多少数据

从数据搜集到机器学习的各个阶段,我们都面临着一个问题,就是到底需要多少数据来完成我们的分析任务。 数据搜集阶段 由于数据的搜集是高投入的,所以在开始数据搜集之前,业务负责人会向数据分析师抛出一些问题,例如“你需要什么样的数据?”,“你需要多少数据?” 数据分析阶段 在数据分析阶段,数据分析师会拿到一批数据,这时面临的问题是,哪些数据是和分析目标相关的?数据量是否够用?如果数据量够用,用多少数据进行...

weixin_37801695的博客 3061

在 Azure ML 上用 .NET 跑机器学习

.NET ML 你在用了吗?

Kinfey 4444

机器学习,多少数据量是合适的?

经验表明,训练数据中每个类别有5000个以上样本,其实也要相对于特征而言,来判断样本数目是不是足够,数据量是足够的,正负样本差一个数量级以内是可以接受的,不太需要考虑数据不平衡问题(完全是经验,没有理论依据,仅供参考)。 ...

shuijinghua的博客 7586

用 ML.NET 开发智能应用:让 .NET 程序员轻松掌握机器学习

ML.NET是一个由微软开发的开源跨平台机器学习框架,专为 .NET 开发者设计,允许他们在不离开 C# 或 F# 编程语言的情况下,进行机器学习建模和应用。通过 ML.NET,开发者无需学习 Python 或深度学习框架的复杂操作,就能在其现有的 .NET 应用中集成强大的机器学习功能。ML.NET 支持各种机器学习任务,包括分类、回归、聚类、推荐、异常检测、自然语言处理等。无论是开发企业级应用、Web 应用,还是桌面应用,ML.NET 都能为你的项目带来智能化提升。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 3877

2、数据并行训练:加速机器学习模型训练的有效方法

本文探讨了单节点训练的瓶颈及其解决方案,重点介绍了数据并行训练作为加速机器学习模型训练的有效方法。文章分析了数据加载带宽和模型训练带宽不匹配的问题,并详细阐述了数据并行训练的工作原理、加速效果以及相关关键技术,如随机梯度下降(SGD)和模型同步。此外,还讨论了超参数调优的重要性及实际应用、数据并行训练的挑战与解决方案,以及未来发展趋势。通过合理应用数据并行训练技术,可以显著提高模型训练效率和性能。

ujm56789012的博客 65

你究竟需要多少训练数据?

点击上方“AI公园”,关注公众号,选择加“星标“或“置顶”作者:DanMalowany编译:ronghuaiyang导读对标注数据的收益递减效应进行量化的预测。深度学习模型对训练数据的需...

AI公园 1477

CANoe实战:LIN Slave一致性测试全流程解析

本文详细解析了使用CANoe进行LIN Slave一致性测试的全流程,包括测试概述、环境搭建、模块集成、测试用例详解及报告分析。通过实际案例分享,帮助工程师掌握LIN 2.0/2.1/2.2、SAE J2602和ISO 17987等标准的自动化测试方法,提升汽车电子从节点的可靠性和兼容性验证效率。

weixin_42665725的博客 533

机器学习:支持向量机(SVM)

支持向量机(SVM)是一类按监督学习方式对数据进行二元分类的广义线性分类器,其决策边界是对学习样本求解的最大边距超平面,可以将问题化为一个求解凸二次规划的问题。与逻辑回归和神经网络相比,支持向量机,在学习复杂的非线性方程时提供了一种更为清晰,更加强大的方式。

燕双嘤 20万+

SAP 发货在途库存管理:POD确认差异下的2种后续调整方案对比

本文详细解析了SAP发货在途库存管理中POD确认差异后的财务调整方案,对比了移动类型417和555 T两种处理方式的适用场景及财务影响。通过实际案例说明如何优化POD流程,减少库存差异损失,提升供应链管理效率。特别适合SAP SD模块用户及供应链管理人员参考。

chiman6219的博客 397

Intouch间接变量(扩展)

间接变量只是Intouch提供给开发者的便捷方式之一,并不是所有情况都一定要使用间接变量,有时候用条件语句或者内存变量的方式也能起到类似的作用。

weixin_41571357的博客 2170

我的机器学习项目需要多少训练数据?

作者:景略集智 链接:https://www.zhihu.com/question/63304628/answer/538598523 来源:知乎 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 高性能模型与低性能模型之间区别的一个重要原因就是训练数据的质量。因此,为了确保你的 AI 应用能够具有最大性能,必须弄明白你需要多少训练数据。 然而,这个问题经常让...

TEDDY的博客 3222

IDEA+JRebel实现SpringBoot+MyBatis Plus项目热部署全攻略(含XML热更新实战)

本文详细介绍了如何在IDEA中使用JRebel为SpringBoot与MyBatis Plus项目配置高效的热部署方案。通过安装激活JRebel插件并配置关键扩展,重点解决了MyBatis XML映射文件修改后无法即时生效的痛点,实现了Java代码与XML文件的秒级热更新,从而彻底摆脱频繁重启应用的开发困境,大幅提升编码与调试效率。

weixin_28831341的博客 475

机器学习:你需要多少训练数据?

来源:Medium 作者:Malay Haldar 翻译:李宏菲 作者为Google 软件工程师,美国西北大学电子信息工程博士,擅长大规模分布式系统,编译器和数据库。 从谷歌的机器学习代码中得知,目前需要一万亿个训练样本 训练数据的特性和数量是决定一个模型性能好坏的最主要因素。一旦你对一个模型输入比较全面的训练数据,通常针对这些训练数据,模型也

zylxadz的专栏 7466

基于MATLAB的多无人机多任务调度算法——CBBA带时间窗

本文将介绍基于MATLAB的CBBA算法,并对其进行改进,加入时间窗概念,以提高多无人机系统的调度效率和性能。时间窗用于限定任务的执行时间范围,以避免任务执行时间过长或过短导致的问题。具体而言,我们为每个任务设置一个允许的最早开始时间和最晚结束时间,并在任务分配的过程中考虑这些时间约束。在多无人机系统中,需要将若干个任务分配给不同的无人机完成,以实现高效的任务执行。以上是关于基于MATLAB的多无人机多任务调度算法CBBA带时间窗的简要介绍和源代码实现。多无人机系统的调度问题。

BUG?不存在的! 1899

osgPython

osgPython是一组 Python 模块,为 OpenSceneGraph 的 C++ 库提供了完整的 Python 接口。这意味着你可以在 Python 中调用几乎所有的 OSG 功能,从创建简单的场景到复杂的渲染效果。核心优势开发速度快:Python 语法简洁,无需编译,快速迭代易于学习:比 C++ 更易上手,适合原型开发和教学生态丰富:可以结合 NumPy、Matplotlib 等科学计算库跨平台:与 OSG 一样支持 Windows、Linux、macOS性能考虑。

深之JohnChen的专栏 459

机器学习0006 训练需要多少标注数据

机器学习0006 训练需要多少标注数据 之前我也不清楚究竟需要多少训练数据,觉得是越多越好。最近看过一篇文章,并不是自己试验出来的结论,我觉得这个结论比较靠谱。 1.一般情况下,每类给定5000标注样本,可以训练出可接受性能的模型。 2.至少有1000万标注数据的情况下,可以训练出与人类水平接近或超越人类水平的模型。

神码不是浮云 2477

【虚幻引擎UE】UE5 四步骤实现AI漫游与对话行为(含工程源码)

【虚幻引擎UE】UE5 四步骤实现AI漫游与对话行为(含工程源码)

灵境引路人 3229

python训练模型需要多少数据_机器学习要求多大的数据量?我做的东西到底是不是机器学习?...

重点回答头一个问题,因为这也是很多机器学习研究者普遍存在的问题:“我的项目需要多少训练数据?”高性能模型与低性能模型之间区别的一个重要原因就是训练数据的质量。因此,为了确保你的 AI 应用能够具有最大性能,必须弄明白你需要多少训练数据。然而,这个问题经常让不少开发者非常苦恼。实际上,这个问题回答起来比看上去要复杂的多,因为其中要涉及到很多因素,比如你使用的模型类型,模型在实际业务中的用途等等。下面...

weixin_39604045的博客 1825

西门子SMART PLC增量式PID(完整梯形图FC)

西门子PLC自带的PID指令是基于位置型的PID,位置型PID的算法公式和详细介绍,大家可以参看《PID专栏》的其它文章,这里不再赘述。本篇博文直接给出代码部分的讲解,不设计太多公式和理论的推导。限于本人能力,文中难免出现错误和不足之处,诚恳欢迎大家的批评和指正。同时感谢大家的订阅和关注。SMART200 PLC系统自带的PID指令解析,可以参看下面这篇文章:SMART PLC PID算法基本解析(附公式)_RXXW_Dor的博客-优快云博客_plc的pid算法在态运行中,控制器调节输出值,使偏差 (e

RXXW_Dor的博客 8149

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

Unity 机器学习(ML-Agents) 基础

Unity 机器学习 ML-Agents 基础Unity 官方示例下载ML-Agents 部分Python 下载AnacondaAnaconda 虚拟环境构建 ML-Agents安装 ML-Agents Python 包安装 ML-Agents 包ML-Agents 入门指南Unity Hub 部分虚拟环境 训练虚拟环境 训练运行:虚拟环境 开始训练:虚拟环境 观察训练进度:虚拟环境 停止训练虚拟环境 恢复训练虚拟环境 训练模型ML-Agents 打造新的学习环境ML-Agents 资产导入 Unity 官

Maddie_Mo的博客 1万+

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

上一篇: 五分钟了解AI常见术语
下一篇: 7个获得训练数据的方法
AONDATA
博客等级 码龄9年 74粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值