华为云AI开发平台ModelArts梯度提升树回归特征重要性_云淘科技

概述

采用梯度提升树回归算法计算数据集特征的特征重要性。

输入

参数

子参数

参数说明

inputs

dataframe

参数必选,表示输入的数据集;如果没有pipeline_model和gbt_regressor_model参数,表示直接根据数据集训练梯度提升树回归模型得到特征重要性

pipeline_model

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

gbt_regressor_model

参数可选,如果含有该参数,表示根据上游的gbt_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

subsampling_rate

训练每棵树时,对训练集的抽样率,默认为1

max_iter

最大迭代次数,默认为20

step_size

步长,默认为0.1

样例

inputs = {
    "dataframe": None,  # @input {"label":"dataframe","type":"DataFrame"}
    "pipeline_model": None,  # @input {"label":"pipeline_model","type":"PipelineModel"}
    "gbt_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": ""}
    "subsampling_rate": 1.0,  # @param {"label": "subsampling_rate", "type": "number", "required": "false", "helpTip": ""} 
    "loss_type": "squared",  # @param {"label": "loss_type", "type": "enum", "required": "false", "options": "squared, absolute", "helpTip": ""} 
    "max_iter": 20,  # @param {"label": "max_iter", "type": "integer", "required": "false","range":"(0,2147483647]", "helpTip": ""} 
    "step_size": 0.1,  # @param {"label": "step_size", "type": "number", "required": "false", "helpTip": ""}
    "impurity": "variance"
}
gbt_regression_feature_importance____id___ = MLSGBTRegressorFeatureImportance(**params)
gbt_regression_feature_importance____id___.run()
# @output {"label":"dataframe","name":"gbt_regression_feature_importance____id___.get_outputs()['output_port_1']","type":"DataFrame"}

父主题: 数据分析

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

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