华为云AI开发平台ModelArts决策树回归特征重要性_云淘科技

概述

采用决策树回归算法计算数据集特征的特征重要性。

输入

参数

子参数

参数说明

inputs

dataframe

参数必选,表示输入的数据集;如果没有pipeline_model和decision_tree_regressor_model参数,表示直接根据数据集训练决策树回归算法得到特征重要性

pipeline_model

参数可选,如果含有该参数,表示根据上游的pyspark pipeline模型对象来计算特征重要性

decision_tree_regressor_model

参数可选,如果含有该参数,表示根据上游的决策树回归模型对象来计算特征重要性

输出

包含特征重要性的结果数据集

参数说明

参数

子参数

参数说明

input_columns_str

数据集的特征列名组成的格式化字符串,例如:

“column_a”

“column_a,column_b”

label_col

目标列名

model_input_features_col

特征向量的列名

prediction_col

训练模型时,预测结果对应的列名,默认为”prediction”

max_depth

树的最大深度,默认为5

max_bins

分割特征时的最大分箱个数,默认为32

min_instances_per_node

决策树分裂时要求每个节点必须包含的实例数目,默认为1

min_info_gain

最小信息增益,默认为0.0

样例

inputs = {
    "dataframe": None,  # @input {"label":"dataframe","type":"DataFrame"}
    "pipeline_model": None,  # @input {"label":"pipeline_model","type":"PipelineModel"}
    "decision_tree_regressor_model": None
}
params = {
    "inputs": inputs,
    "input_columns_str": "",  # @param {"label":"input_columns_str","type":"string","required":"false","helpTip":""}
    "label_col": "",  # @param {"label":"label_col","type":"string","required":"true","helpTip":""}
    "model_input_features_col": "model_features",  # @param {"label":"model_input_features_col","type":"string","required":"false","helpTip":""}
    "prediction_col": "prediction",  # @param {"label":"prediction_col","type":"string","required":"false","helpTip":""}
    "max_depth": 5,  # @param {"label":"max_depth","type":"integer","required":"false","range":"(0,2147483647]","helpTip":""}
    "max_bins": 32,  # @param {"label":"max_bins","type":"integer","required":"false","range":"(0,2147483647]","helpTip":""}
    "min_instances_per_node": 1,  # @param {"label":"min_instances_per_node","type":"integer","required":"false","range":"(0,2147483647]","helpTip":""}
    "min_info_gain": 0.0,  # @param {"label":"min_info_gain","type":"number","required":"false","helpTip":""}
    "impurity": "variance"
}
dt_regression_feature_importance____id___ = MLSDecisionTreeRegressorFeatureImportance(**params)
dt_regression_feature_importance____id___.run()
# @output {"label":"dataframe","name":"dt_regression_feature_importance____id___.get_outputs()['output_port_1']","type":"DataFrame"}

父主题: 数据分析

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

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