华为云AI开发平台ModelArts线性回归_云淘科技

概述

“线性回归”节点用于产生线性回归模型。它是利用数理统计中的回归分析,来确定两种或两种以上变数间相互依赖的定量关系的统计分析方法。

输入

参数

子参数

参数说明

inputs

dataframe

inputs为字典类型,dataframe为pyspark中的DataFrame类型对象

输出

spark pipeline类型的模型

参数说明

参数

子参数

参数说明

b_use_default_encoder

是否使用默认编码,默认为True

input_features_str

输入的列名以逗号分隔组成的字符串,例如:

“column_a”

“column_a,column_b”

label_col

目标列

regressor_feature_vector_col

算子输入的特征向量列的列名,默认为”model_features”

max_iter

最大迭代次数,默认为100

reg_param

正则化参数,默认为0.0

elastic_net_param

弹性网络参数,默认为0.0

tol

收敛阈值,默认为1e-6

fit_intercept

是否使用截距,默认为True

standardization

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

solver

优化时采用的处理算法,支持l-bfgs、normal、auto,默认为”auto”

aggregation_depth

聚合深度,默认为2

loss

损失函数类型,支持squaredError、huber,默认为”squaredError”

epsilon

默认为1.35

样例

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"}
    "regressor_feature_vector_col": "model_features",  # @param {"label": "regressor_feature_vector_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.0,none)", "helpTip": ""}
    "elastic_net_param": 0.0,  # @param {"label": "elastic_net_param", "type": "number", "required": "true", "range": "[0.0,none)", "helpTip": ""}
    "tol": 1e-6,  # @param {"label": "tol"", "type": "number", "required": "true", "range": "[0.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": ""}
    "solver": "auto",  # @param {"label": "solver", "type": "enum", "required": "true", "options": "l-bfgs,normal,auto", "helpTip": ""}
    "aggregation_depth": 2,  # @param {"label": "aggregation_depth", "type": "integer", "required": "true", "range": "(0,2147483647]", "helpTip": ""}
    "loss": "squaredError",  # @param {"label": "loss", "type": "enum", "required": "true", "options": "squaredError,huber", "helpTip": ""}
    "epsilon": 1.35  # @param {"label": "epsilon", "type": "number", "required": "true", "range": "(1.0,none)", "helpTip": ""}
}
linear_regression____id___ = MLSLinearRegression(**params)
linear_regression____id___.run()
# @output {"label":"pipeline_model","name":"linear_regression____id___.get_outputs()['output_port_1']","type":"PipelineModel"}

父主题: 回归

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

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