华为云AI开发平台ModelArts决策树分类_云淘科技
概述
“决策树分类”节点用于产生二分类或多分类模型。
决策树是附加概率结果的一个树状的决策图,是直观的运用统计概率分析的图法,树中的每一个节点表示对象属性的判断条件,其分支表示符合节点条件的对象,树的叶子节点表示对象所属的预测结果。其通过基尼不纯度(Gini impurity)或熵(Entropy)来对一个集合的有序程度进行量化,并对一次拆分进行量化评价。
输入
参数 |
子参数 |
参数说明 |
---|---|---|
inputs |
dataframe |
inputs为字典类型,dataframe为pyspark中的DataFrame类型对象 |
输出
spark pipeline类型的模型
参数说明
参数 |
子参数 |
参数说明 |
---|---|---|
b_use_default_encoder |
– |
是否使用默认编码,默认为True |
input_features_str |
– |
输入的特征列名以逗号分隔组成的格式化字符串,例如: “column_a” “column_a,column_b” |
label_col |
– |
目标列 |
classifier_label_index_col |
– |
目标列经过标签编码后的新的列名,默认为”label_index” |
classifier_feature_vector_col |
– |
算子输入的特征向量列的列名,默认为”model_features” |
prediction_index_col |
– |
算子输出的预测label对应的标签列,默认为”prediction_index” |
prediction_col |
– |
算子输出的预测label的列名,默认为”prediction” |
max_depth |
– |
树的最大深度,默认为5 |
max_bins |
– |
最大分箱数,默认为32 |
min_instances_per_node |
– |
树节点分割时要求子节点包含的最小实例数,默认为1 |
min_info_gain |
– |
最小信息增益,默认为0 |
impurity |
– |
不纯度,支持entropy、gini,默认为”gini” |
样例
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": ""} "classifier_label_index_col": "label_index", # @param {"label": "classifier_label_index_col", "type": "string", "required": "true", "helpTip": ""} "classifier_feature_vector_col": "model_features", # @param {"label": "classifier_feature_vector_col", "type": "string", "required": "true", "helpTip": ""} "prediction_index_col": "prediction_index", # @param {"label": "prediction_index_col", "type": "string", "required": "true", "helpTip": ""} "prediction_col": "prediction", # @param {"label": "prediction_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": "[1,2147483647]", "helpTip": ""} "min_info_gain": 0.0, # @param {"label": "min_info_gain", "type": "number", "required": "true", "range": "[0,none)", "helpTip": ""} "impurity": "gini" # @param {"label": "impurity", "type": "enum", "required": "true", "options": "entropy,gini", "helpTip": ""} } dt_classifier____id___ = MLSDecisionTreeClassifier(**params) dt_classifier____id___.run() # @output {"label":"pipeline_model","name":"dt_classifier____id___.get_outputs()['output_port_1']","type":"PipelineModel"}
父主题: 分类
同意关联代理商云淘科技,购买华为云产品更优惠(QQ 78315851)
内容没看懂? 不太想学习?想快速解决? 有偿解决: 联系专家