华为云AI开发平台ModelArts逻辑回归分类_云淘科技

概述

“逻辑回归”节点用于数据二分类,支持自动化建模。它可以根据输入训练集高效地完成参数自动调优,并通过LOGISTIC函数将线性回归的输出映射到[0,1]区间,最后根据阈值判断完成数据二分类。

逻辑回归本质上是一种线性分类方法,因此在考虑使用逻辑回归模型前,要保证所提出的特征与目标变量之间的关系可以使用线性模型来表达。特征与目标变量之间的线性关系越强,逻辑回归的模型性能越好。

输入

参数

子参数

参数说明

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_col

算子输出的预测label对应的标签列,默认为”prediction_index”

prediction_index_col

算子输出的预测label的列名,默认为”prediction”

max_iter

最大迭代次数,默认为100

reg_param

正则化参数,默认为0.0

elastic_net_param

弹性网络参数,默认为0.0

tol

迭代算法的收敛阈值,默认为1e-6

fit_intercept

是否要使用截距,默认为True

standardization

是否正则化特征,默认为True

aggregation_depth

聚合的深度,默认为2

family

模型训练中使用哪种标签分布,支持auto、binomial、multinomial,默认为”auto”

样例

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": "target label column"}
    "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_col": "prediction",  # @param {"label": "prediction_col", "type": "string", "required": "true", "helpTip": ""}
    "prediction_index_col": "prediction_index",  # @param {"label": "prediction_index_col", "type": "string", "required": "true", "helpTip": ""}
    "max_iter": 100,  # @param {"label": "max_iter", "type": "integer", "required": "true", "range": "(0,2147483647]", "helpTip": ""}
    "reg_param": 0.0,  # @param {"label": "reg_param", "type": "number", "required": "true", "range": "[0,none)", "helpTip": ""}
    "elastic_net_param": 0.0,  # @param {"label": "elastic_net_param", "type": "number", "required": "true", "range": "[0,none)", "helpTip": ""}
    "tol": 1e-6,  # @param {"label": "tol", "type": "number", "required": "true", "range": "(0,none)", "helpTip": ""}
    "fit_intercept": True,  # @param {"label": "fit_intercept", "type": "boolean", "required": "true", "helpTip": ""}
    "standardization": True,  # @param {"label": "standardization", "type": "boolean", "required": "true", "helpTip": ""}
    "aggregation_depth": 2,  # @param {"label": "aggregation_depth", "type": "integer", "required": "true", "range": "(0,2147483647]", "helpTip": ""}
    "family": "auto",  # @param {"label": "family", "type": "enum", "required": "true", "options":"auto,binomial,multinomial", "helpTip": ""}
    "lower_bounds_on_coefficients": None,
    "upper_bounds_on_coefficients": None,
    "lower_bounds_on_intercepts": None,
    "upper_bounds_on_intercepts": None
}
lr_classifier____id___ = MLSLogisticRegressionClassifier(**params)
lr_classifier____id___.run()
# @output {"label":"pipeline_model","name":"lr_classifier____id___.get_outputs()['output_port_1']","type":"PipelineModel"}

父主题: 分类

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

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