随机森林代码审查

发布于 2024-11-10 07:58:56 字数 504 浏览 6 评论 0原文

我正在做一个关于随机森林算法的研究项目。我发现了该算法的许多实现,但代码的主要部分通常是用 Fortran 编写的,而我对此完全天真。

我必须编辑代码,更改主要参数(如树深度、特征变量数量……)并跟踪每次运行期间算法的性能。

目前我正在使用“Windows-Precompiled-RF_MexStandalone- v0.02-”。训练和预测函数是 matlab mex 文件,无法打开或编辑。任何人都可以给我一些关于该怎么做的建议,或者是否有一个有效且完全基于 matlab 的随机森林版本。


我仔细阅读了 randomforest-matlab 。不幸的是,主要的训练部分是一个 dll 文件。通过阅读更多内容,我的大部分疑问现在都得到了解决。我的问题主要是如何同时运行几棵树。

I'm doing a research project on random forest algorithm. I have found numerous implementations of the algorithm but the main part of the code is often written in Fortran while I'm completely naive in it.

I have to edit the code, change the main parameters (like tree depth, num of feature variables, ...) and trace the algorithm's performance during each run.

Currently I'm using "Windows-Precompiled-RF_MexStandalone-v0.02-". The train and predict functions are matlab mex files and can not be opened or edited. Can anyone give me a piece of advice on what to do or is there a valid and completely matlab-based version of random forests.


I've read the randomforest-matlab carefully. The main training part unfortunately is a dll file. Through reading more, most of my wonders is now resolved. My question mainly was how to run several trees simultaneously.

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

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

发布评论

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

评论(4

琉璃梦幻 2024-11-17 07:58:56

您看过这些图书馆吗?

Have you taken a look at these libraries?

谁把谁当真 2024-11-17 07:58:56

如果你正在做一个关于它的研究项目,最好的办法可能是用 C 自己实现单个树训练,然后编写 Mex 包装器。我将从 ID3 树开始(例如,在尝试 C4.5 之前)。然后编写随机森林代码本身,一旦编写了树代码,这并不那么难。

您将:

  1. 学到很多东西
  2. 能够根据需要随意修改它们
  3. 最终继续与它们一起探索新领域

我自己从头开始实现了它们,因此一旦您发布了一些自己的代码,我就可以提供帮助。但我认为这个网站上没有人会为您编写代码。

会需要努力吗?是的。当你走出困境时,你会比刚开始时拥有更多的知识和能力吗?毫无疑问。

If you're doing a research project on it, the best thing is probably to implement the individual tree training yourself in C and then write Mex wrappers. I'd start with an ID3 tree (before attempting C4.5 for instance.) Then write the random forest code itself, which, once you write the tree code, isn't all that hard.

You'll:

  1. learn a lot
  2. be able to modify them as much as you like
  3. eventually move on to exploring new areas with them

I've implemented them myself from scratch so I can help once you post some of your own code. But I don't think anybody on this site will write the code for you.

Will it take effort? Yes. Will you come out of it with more knowledge and ability than you had going in? Undoubtably.

我的影子我的梦 2024-11-17 07:58:56

R 中有一个很好的库,称为 randomForest。它基于 Breiman 在 Fortran 中的原始实现,但现在主要用 C 重新编码。

http://cran.r-project.org/web/packages/randomForest/index.html

您谈论的主要参数(树深度,要测试的功能数量,...)是直接可用。

There is a nice library in R called randomForest. It is based on the original implementation of Breiman in Fortran but it is now mainly recoded in C.

http://cran.r-project.org/web/packages/randomForest/index.html

The main parameters you talk about (tree depth, number of features to be tested, ...) are directly available.

时光暖心i 2024-11-17 07:58:56

我推荐的另一个库是 Weka。它基于java并且清晰。尽管与R相比,性能略有下降。源代码可以从http://www.cs.waikato.ac.nz/ml/weka/

Another library I would recommend is Weka. It is java based and lucid.Performance is slightly off though compared to R. The source code can be downloaded from http://www.cs.waikato.ac.nz/ml/weka/

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