如何故意过度拟合Weka树分类器?

发布于 2024-09-09 07:13:36 字数 774 浏览 1 评论 0原文

我有一个二进制类数据集 (0 / 1),与“0”类有很大的偏差(大约 30000 与 1500)。每个实例有 7 个特征,没有缺失值。

当我使用 J48 或任何其他树分类器时,几乎所有“1”实例都被错误分类为“0”。

将分类器设置为“未修剪”,将每个叶子的最小实例数设置为 1,将置信因子设置为 1,添加带有实例 ID 号的虚拟属性 - 所有这些都没有帮助。

我只是无法创建一个过度拟合我的数据的模型!

我还尝试了 Weka 提供的几乎所有其他分类器,但得到了类似的结果。

使用 IB1 可以获得 100% 的准确率(训练集上的训练集),因此这不是具有相同特征值和不同类的多个实例的问题。

如何创建一棵完全未修剪的树? 或者以其他方式迫使 Weka 过度拟合我的数据?

谢谢。

更新:好吧,这很荒谬。我只使用了大约 3100 个负例和 1200 个正例,这就是我得到的树(未修剪!):

J48 unpruned tree
------------------

F <= 0.90747: 1 (201.0/54.0)
F > 0.90747: 0 (4153.0/1062.0)

不用说,IB1 仍然给出 100% 的精度。

更新 2: 不知道我是怎么错过的 - 未经修剪的 SimpleCart 可以正常工作,并在火车上提供 100% 的准确率;修剪后的 SimpleCart 不像 J48 那样有偏差,并且具有不错的误报率和误报率。

I have a binary class dataset (0 / 1) with a large skew towards the "0" class (about 30000 vs 1500). There are 7 features for each instance, no missing values.

When I use the J48 or any other tree classifier, I get almost all of the "1" instances misclassified as "0".

Setting the classifier to "unpruned", setting minimum number of instances per leaf to 1, setting confidence factor to 1, adding a dummy attribute with instance ID number - all of this didn't help.

I just can't create a model that overfits my data!

I've also tried almost all of the other classifiers Weka provides, but got similar results.

Using IB1 gets 100% accuracy (trainset on trainset) so it's not a problem of multiple instances with the same feature values and different classes.

How can I create a completely unpruned tree?
Or otherwise force Weka to overfit my data?

Thanks.

Update: Okay, this is absurd. I've used only about 3100 negative and 1200 positive examples, and this is the tree I got (unpruned!):

J48 unpruned tree
------------------

F <= 0.90747: 1 (201.0/54.0)
F > 0.90747: 0 (4153.0/1062.0)

Needless to say, IB1 still gives 100% precision.

Update 2: Don't know how I missed it - unpruned SimpleCart works and gives 100% accuracy train on train; pruned SimpleCart is not as biased as J48 and has a decent false positive and negative ratio.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我还不会笑 2024-09-16 07:13:36

Weka 包含两个感兴趣的元分类器:

它们允许您使任何算法对成本敏感(不限于 SVM)并指定成本矩阵(各种错误的惩罚);将 1 实例错误分类为 0 的惩罚要比将 0 错误分类为 1 给予的惩罚更高。

结果是算法将尝试:

最小化预期的错误分类成本(而不是最有可能的类别)

Weka contains two meta-classifiers of interest:

They allows you to make any algorithm cost-sensitive (not restricted to SVM) and to specify a cost matrix (penalty of the various errors); you would give a higher penalty for misclassifying 1 instances as 0 than you would give for erroneously classifying 0 as 1.

The result is that the algorithm would then try to:

minimize expected misclassification cost (rather than the most likely class)

乖乖哒 2024-09-16 07:13:36

快速但肮脏的解决方案是重新采样。丢弃除 1500 个之外的所有正面示例,并在平衡的数据集上进行训练。我很确定 Weka 中有一个重新采样组件可以做到这一点。

另一种解决方案是使用每个类别具有可变成本的分类器。我非常确定 libSVM 允许您执行此操作,并且我知道 Weka 可以包装 libSVM。然而,我已经有一段时间没有使用 Weka 了,所以我不能在这里提供太多实际帮助。

The quick and dirty solution is to resample. Throw away all but 1500 of your positive examples and train on a balanced data set. I am pretty sure there is a resample component in Weka to do this.

The other solution is to use a classifier with a variable cost for each class. I'm pretty sure libSVM allows you to do this and I know Weka can wrap libSVM. However I haven't used Weka in a while so I can't be of much practical help here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文