AI开发平台ModelArtsAI开发平台ModelArts

# 线性回归

#### 概述

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

#### 输入

inputs

dataframe

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

#### 输出

spark pipeline类型的模型

#### 参数说明

b_use_default_encoder

-

input_features_str

-

"column_a"

"column_a,column_b"

label_col

-

regressor_feature_vector_col

-

max_iter

-

reg_param

-

elastic_net_param

-

tol

-

fit_intercept

-

standardization

-

solver

-

aggregation_depth

-

loss

-

epsilon

-

#### 样例

```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"}```