华为云AI开发平台ModelArts决策树回归_云淘科技

概述

“决策树回归”节点用于产生回归模型。

决策树算法是递归地构建决策树的过程,用平方误差最小准则,进行特征选择,生成二叉树。平方误差计算公式如下:

其中是样本类标的均值,yi 是样本的标签,N 是样本数量。

输入

参数

子参数

参数说明

inputs

dataframe

inputs为字典类型,dataframe为pyspark中的DataFrame类型对象

输出

spark pipeline类型的模型

参数说明

参数

子参数

参数说明

b_use_default_encoder

是否使用默认编码,默认为True

input_features_str

输入的列名以逗号分隔组成的字符串,例如:

“column_a”

“column_a,column_b”

label_col

目标列

regressor_feature_vector_col

算子输入的特征向量列的列名,默认为”model_features”

max_depth

树的最大深度,默认为5

max_bins

最大分箱数,默认为32

min_instances_per_node

节点分割时,要求子节点必须包含的最少实例数,默认为1

min_info_gain

最小信息增益,默认为0.0

样例

inputs = {
    "dataframe": None  # @input {"label":"dataframe","type":"DataFrame"}
}
params = {
    "inputs": inputs,
    "b_output_action": True,
    "b_use_default_encoder": True,  # @param {"label": "b_use_default_encoder", "type": "boolean", "required": "true", "helpTip": ""}
    "input_features_str": "",  # @param {"label": "input_features_str", "type": "string", "required": "false", "helpTip": ""}
    "outer_pipeline_stages": None,
    "label_col": "",  # @param {"label": "label_col", "type": "string", "required": "true", "helpTip": ""}
    "regressor_feature_vector_col": "model_features",  # @param {"label": "regressor_feature_vector_col", "type": "string", "required": "true", "helpTip": ""}
    "max_depth": 5,  # @param {"label": "max_depth", "type": "integer", "required": "true", "range": "(0,2147483647]", "helpTip": ""}
    "max_bins": 32,  # @param {"label": "max_bins", "type": "integer", "required": "true", "range": "(0,2147483647]", "helpTip": ""}
    "min_instances_per_node": 1,  # @param {"label": "min_instances_per_node", "type": "integer", "required": "true", "range": "(0,2147483647]", "helpTip": ""}
    "min_info_gain": 0.0,  # @param {"label": "min_info_gain", "type": "number", "required": "true", "range": "[0.0,none)", "helpTip": ""}
    "impurity": "variance"
}
dt_regressor____id___ = MLSDecisionTreeRegression(**params)
dt_regressor____id___.run()
# @output {"label":"pipeline_model","name":"dt_regressor____id___.get_outputs()['output_port_1']","type":"PipelineModel"}

父主题: 回归

同意关联代理商云淘科技,购买华为云产品更优惠(QQ 78315851)

内容没看懂? 不太想学习?想快速解决? 有偿解决: 联系专家