R 采样绕过 randomForest 32 因子限制

发布于 2024-12-25 15:19:30 字数 1459 浏览 2 评论 0原文

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

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

发布评论

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

评论(2

无人问我粥可暖 2025-01-01 15:19:30

您还可以将 100 级变量拆分为 4 个单独的变量,每个变量有 25 个级别。这会导致线性模型出现棘手的混叠问题,但对于随机森林,您不必担心这一点。

You could also split your 100-level variable into 4 separate variables, each with 25 levels. This would result in tricky aliasing issues with a linear model, but you're not worried about that with a random forest.

婴鹅 2025-01-01 15:19:30

我可以推荐两种方法:

  1. 您可以将 100 级变量转换为 100 个二进制变量。它们中的每一个都代表一个原始级别(0 - 假,1 - 真)。因此,您将能够使用整个数据集并创建随机森林模型。但在这种情况下,数据集的内存消耗将会增加,并且您可能需要使用一些额外的包来处理大型数据集。

  2. 第二种可能性是通过替换来制作原始数据集的许多样本。因为如果您在不进行替换的情况下分割数据集,您的模型就会出现偏差。但尽管如此,我认为您需要进行 10-15 次以上的分割才能避免偏差。我不能说到底有多少。也许大约有数百个或更多。这取决于您的数据集。因为如果 100 个级别中每个级别的对象数量显着不同,那么分割后您将收到大小显着不同的样本,并且会影响模型的预测能力。在这种情况下,应该增加分割数量。

I could recommend 2 ways:

  1. You can transform you 100-level variable into 100 binary variables. Each of them will represent one original level (0 - false, 1 - true). Thus you will be able to work with the whole dataset and make random forest model as well. But in this case the memory consumption by your dataset will increase and you will probably need to use some additional packages for working with huge datasets.

  2. Second posibility is to make many samples of your original dataset with replacement. Because if you will split dataset without replacement you will have a bias in the model. But nevertheless I think you will need to make much more than 10-15 splits to avoid bias. I can not say how many exactly. Maybe around several hundreds or more. It depends on your dataset. Because if number of objects of each out of 100 levels is significantly different, then after spliting you will receive samples of significantly different size, and it can affect predictive ability of the model. In such a case number of splits should be increased.

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