KAGGLE比赛中集成方法使用教程(KAGGLE ENSEMBLING GUIDE)

KAGGLE比赛中集成方法使用教程(KAGGLE ENSEMBLING GUIDE)

Model ensembling is a very powerful technique to increase accuracy on a variety of ML tasks. In this article I will share my ensembling approaches for Kaggle Competitions.

模型集成在很多机器学习任务中是一个很有效的方法。这篇文章主要分享下我在Kaggle比赛中使用到的集成方法。


For the first part we look at creating ensembles from submission files. The second part will look at creating ensembles through stacked generalization/blending.

第一部分我们先从提交的文件来创建集成。第二部分将会看一下从堆叠泛化/混合来创建集成。


I answer why ensembling reduces the generalization error. Finally I show different methods of ensembling, together

with their results and code to try it out for yourself.

我会回答为什么集成可以降低模型泛化的错误率。最后我们展示不同的集成方法,包括他们的结果和代码供你尝试。


This is how you win ML competitions: you take other peoples’ work and ensemble them together.”

 Vitaly Kuznetsov NIPS2014

“怎么赢取ML比赛:拿到别人的工作,然后把他们集成起来”Vitaly Kuznetsov NIPS2014


Creating ensembles from submission files
从提交的文件创建集成

The most basic and convenient way to ensemble is to ensemble Kaggle submission CSV files. You only need thepredictions on the test set for these methods — no need to retrain a model. This makes it a quick way to ensemblealready existing model predictions, ideal when teaming up.
最简单和方便的集成方法就是集成

Kaggle提交的CSV文件。你仅仅需要这些方法的预测结果-不需要重新训练模型。这个方法

迅速的集成现有模型的预测结果,适合团队合作。

Voting ensembles.

投票集成

We first take a look at a simple majority vote ensemble. Let’s see why model ensembling reduces error rate and

why it works better to ensemble low-correlated model predictions.

我们首先看一下简单的多数表决集成。看一下为什么模型集成可以降低错误率,为什么集成一些不太相关的模型预测效果会

更好。


Error correcting codes
纠错码错误

During space missions it is very important that all signals are correctly relayed.

在空间任务,所有信号被正确地传播十分重要。

If we have a signal in the form of a binary string like:

如果我们有一个二进制字符串信号比如:

1110110011101111011111011011
and somehow this signal is corrupted (a bit is flipped) to:

并且不知何故,这个信号被损坏(一个位被翻转)

1010110011101111011111011011
then lives could be lost.

coding solution was found in error correcting codes. The simplest error correcting code is a repetition-code: Relay the

signal multiple times in equally sized chunks and have a majority vote.

在纠错码中发现了一个编码解决方案。最简单的纠错码是重复码:用相同的大小块多次传播信号并且进行多数表决。

Original signal:
1110110011

Encoded:
10,3 101011001111101100111110110011

Decoding:
1010110011
1110110011
1110110011

Majority vote:
1110110011

Signal corruption is a very rare occurrence and often occur in small bursts. So then it figures that it is even rarer to have a

corrupted majority vote.

信号损坏是非常罕见的状况,并且经常发生在小突发中。 因此它认为在多数表决中出现损坏的概率更小。

As long as the corruption is not completely unpredictable (has a 50% chance of occurring) then signals can be repaired.

只要损坏不是完全不可预测的(有50%的概率发生),那么信号就可以被修复。


A machine learning example

一个机器学习的例子

Suppose we have a test set of 10 samples. The ground truth is all positive (“1”):

假设我们有一个10个样本的测试集,真实值全部都是1:

1111111111
We furthermore have 3 binary classifiers (A,B,C) with a 70% accuracy. You can view these classifiers for now as

pseudo-random number generators which output a “1” 70% of the time and a “0” 30% of the time.

我们还有3个准确率为70%的二分类器(A,B,C)。你暂时可以认为是一个伪随机数发生器,70%的时间输出为1,30%的时间输出

0。

We will now show how these pseudo-classifiers are able to obtain 78% accuracy through a voting ensemble.

我们现在将展示这些伪随机数发生器是如何通过表决集成来达到78%的准确率的。

A pinch of maths

一些数学

For a majority vote with 3 members we can expect 4 outcomes:

对一个3个成员的多数表决,我们可以获得4中输出:

All three are correct
  0.7 * 0.7 * 0.7
= 0.3429

Two are correct
  0.7 * 0.7 * 0.3
+ 0.7 * 0.3 * 0.7
+ 0.3 * 0.7 * 0.7
= 0.4409

Two are wrong
  0.3 * 0.3 * 0.7
+ 0.3 * 0.7 * 0.3
+ 0.7 * 0.3 * 0.3
= 0.189

All three are wrong
  0.3 * 0.3 * 0.3
= 0.027
We see that most of the times (~44%) the majority vote corrects an error. This majority vote ensemble will be correct an

average of ~78% (0.3429 + 0.4409 = 0.7838).

我们可以看到大部分时间(~44%)多数表决纠正了错误。多数表决集成~78%( 0.3429 + 0.4409 = 0.7838)的时间是正确的。

Number of voters

投票者数量

Like repetition codes increase in their error-correcting capability when more codes are repeated, so do ensembles

usually improve when adding more ensemble members.

类似重复编码时可以增加它们的纠错能力,当证据集成的成员时,集成的性能也会得到改善。



Using the same pinch of maths as above: a voting ensemble of 5 pseudo-random classifiers with 70% accuracy would be

correct ~83% of the time. One or two errors are being corrected during ~66% of the majority votes. (0.36015 + 0.3087)

使用和上面相同的数据:一个由5个70%准确率的伪随机分类器组成的投票集成可以达到~83%的准确率。




  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Kaggle 是一个数据科学和机器学习社区平台,提供了丰富的数据集、竞赛和教程资源。下面是一个简单的 Kaggle 使用教程: 1. 注册一个 Kaggle 账号:访问 Kaggle 官网(https://www.kaggle.com/)并点击右上角的 "Sign Up" 进行注册。 2. 探索数据集:在 Kaggle 上有数千个开放的数据集可供使用。你可以通过搜索或浏览不同的领域和主题来找到感兴趣的数据集。 3. 下载数据集:一旦你找到了想要使用的数据集,你可以点击数据集页面上的 "Download" 进行下载。 4. 参加竞赛:Kaggle 上有举办各种机器学习竞赛,你可以选择参加感兴趣的竞赛。竞赛页面会提供详细的问题描述、数据集和评估指标等信息。 5. 提交结果:在竞赛页面上,你可以下载竞赛提供的训练和测试数据集。你需要使用训练数据集建立模型,并在测试数据集上进行预测。最后,你将提交你的预测结果,Kaggle 会根据评估指标对你的结果进行评估。 6. 加入讨论和社区:Kaggle 是一个活跃的社区平台,你可以加入不同的讨论组、论坛或组织,并与其他数据科学家、机器学习工程师交流和分享经验。 此外,Kaggle 还提供了大量的教程和内置的笔记本资源,用于学习和实践机器学习算法和数据分析技术。你可以在 Kaggle 上搜索并浏览相关的教程资源,以提升你的数据科学技能。 希望这个简单的教程能帮助你开始使用 Kaggle!如有更多问题,请继续提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值