使用H2O从R到Python创建类似的决策树模型

2024-09-29 18:38:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正在尝试使用H2O建立一个决策树模型

我看到一些问题,说我们可以通过在内部扭曲命令来使用随机林

如何将R代码更改为H2O Python代码

tree = rpart(test ~ ., control = rpart.control(minbucket = nrow(data_test)/100, maxdepth = 2))

我的那个看起来很奇怪,不起作用

rf_model = H2ORandomForestEstimator(balance_classes=True, ntrees=1, max_depth=2,
                                 mtries=10, seed=123, score_each_iteration=True)

rf_model.train(x=features, y='test', training_frame=h2o_df)

Tags: 代码模型test命令决策树truetreedata
1条回答
网友
1楼 · 发布于 2024-09-29 18:38:12

您可以尝试使用以下H2O函数:H2O.randomForest()link with an example

关于您的参数,对于min_bucket,我会尝试min_rows=1,即使min_rows应用于所有叶,而不仅仅是终端叶

相关问题 更多 >

    热门问题