华为云AI开发平台ModelArts决策树分类特征重要性_云淘科技
概述
采用决策树分类算法计算数据集特征的特征重要性。
输入
参数 |
子参数 |
参数说明 |
---|---|---|
inputs |
dataframe |
参数必选,表示输入的数据集。 如果没有pipeline_model和decision_tree_classify_model参数,表示直接根据数据集训练决策树分类算法得到特征重要性 |
pipeline_model |
参数可选,如果含有该参数,表示根据上游的pyspark pipeline模型对象来计算特征重要性 |
|
decision_tree_classify_model |
参数可选,如果含有该参数,表示根据上游的决策树分类模型对象来计算特征重要性 |
输出
包含特征重要性的结果数据集
参数说明
参数 |
子参数 |
参数说明 |
---|---|---|
input_columns_str |
– |
数据集的特征列名组成的格式化字符串,例如: “column_a” “column_a,column_b” |
label_col |
– |
目标列名 |
model_input_features_col |
– |
特征向量的列名 |
classifier_label_index_col |
– |
将目标列按照标签编码后的列名,默认为”label_index” |
prediction_index_col |
– |
训练模型时,预测结果对应标签的列名,默认为”prediction_index” |
prediction_col |
– |
训练模型时,预测结果对应的列名,默认为”prediction” |
max_depth |
– |
树的最大深度 |
max_bins |
– |
分割特征时的最大分箱个数 |
min_instances_per_node |
– |
决策树分裂时要求每个节点必须包含的实例数目 |
min_info_gain |
– |
最小信息增益 |
impurity |
– |
计算信息增益的标准,支持”gini”和”entropy” |
样例
inputs = { "dataframe": None, # @input {"label":"dataframe","type":"DataFrame"} "pipeline_model": None, # @input {"label":"pipeline_model","type":"PipelineModel"} "decision_tree_classify_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":""} "classifier_label_index_col": "label_index", # @param {"label":"classifier_label_index_col","type":"string","required":"false","helpTip":""} "prediction_index_col": "prediction_index", # @param {"label":"prediction_index_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": "gini" # @param {"label":"impurity","type":"enum","required":"false","options":"entropy,gini","helpTip":""} } dt_classify_feature_importance____id___ = MLSDecisionTreeClassifierFeatureImportance(**params) dt_classify_feature_importance____id___.run() # @output {"label":"dataframe","name":"dt_classify_feature_importance____id___.get_outputs()['output_port_1']","type":"DataFrame"}
父主题: 数据分析
同意关联代理商云淘科技,购买华为云产品更优惠(QQ 78315851)
内容没看懂? 不太想学习?想快速解决? 有偿解决: 联系专家