【问题标题】:H2O randomForest column/feature selectionH2O randomForest 列/特征选择
【发布时间】:2017-08-17 14:16:47
【问题描述】:

在 h2o.randomForest 中,假设我有 5 个输入特征 x=c("A","B","C","D","E"),是否有强制算法始终选择A,B AND 其余特征之一?

【问题讨论】:

    标签: random-forest h2o


    【解决方案1】:

    在这种情况下,h2o.randomForest 只是要求您传递正确的 x(用于预测的列列表)和 y(用于预测的列名),因此您将传递的任何内容都将用作输入。

    您要问的是一个特定于 python 的问题。你想如何传递你需要为它编写逻辑的列列表。您可以定义以下是一个函数并根据需要使用它。

    import random
    myframe = ["a","b","c","d","e"] 
    //You can also set myframe as column name list
    //myframe.remove(_use_response_column_name) this will make it generic
    selectedkeys  = ["a","b"]
    for item in selectedkeys:
        if item in myframe:
            myframe.remove(item)
    selectedkeys.append(random.choice(myframe))    
    print(selectedkeys)
    print(myframe)
    

    您只需将选定的键作为 X 的输入传递。

    【讨论】:

      猜你喜欢
      • 2015-02-11
      • 2012-07-09
      • 2017-06-13
      • 2012-09-29
      • 2013-02-21
      • 1970-01-01
      • 2021-04-13
      相关资源
      最近更新 更多