转载:https://blog.csdn.net/qq_24734217/article/details/75476729
Spark-ML 线性回归 LinearRegression (1)
LinearRegression参数详述:
-
正则化参数-Regparam:(Double)默认值为0.0
Regparam:The Regularization Parameter.,Default Is 0.0
@Since(“1.3.0”) -
适应截距-FitIntercept:(Boolean)如果我们应该适应截距,默认值为true。
FitIntercept:if we should fit the intercept,Default is true.
@Since(“1.5.0”) -
培训功能-Standardization:在拟合模型之前是否规范培训功能,默认为true。
Standardization:Whether to standardize the training features before fitting the model,Default is true.
@Since(“1.5.0”) -
混合参数-ElasticNetParam:(Double)
对于α= 0,惩罚是L2惩罚。
对于α= 1,它是一个L1惩罚。
对于(0,1)中的α,惩罚是L1和L2的组合。
默认值为0.0,这是一个L2惩罚。
ElasticNetParam:Set the ElasticNet mixing parameter.0 for L2 penalty,1 for L1 penalty,(0,1) for a combination of L1 and L2.Default is 0.0
@Since(“1.4.0”) -
最大迭代次数-MaxIter:最大迭代次数。默认值为100。
MaxIter:the maximum number of iterations,Default is 100.
@Since(“1.3.0”) -
迭代的收敛公差-Tol:(Double)设置迭代的收敛公差。
更小的价值将导致更高的准确性与更多的迭代的成本。默认为1E-6。
Tol:the convergence tolerance of iterations.Default is 1E-6.
@Since(“1.4.0”) -
权重-WeightCol:(String)是否根据给定的权重weightCol进行过度/低于样本的训练实例。
如果没有set或为空,则所有实例都被平等对待(重量为1.0)。
默认没有set,所以所有的实例都有权重。
WeightCol:Whether to over-/under-sample training instances according to the given weights in weightCol,Default is weight 1.0.
val w = if (!isDefined(weightCol) || $(weightCol).isEmpty) lit(1.0) else col($(weightCol))
@Since(“1.6.0”) -
求解算法-Solver:(String)设置用于优化的求解算法。
在线性回归的情况下,这可以是“l-bfgs”,“normal”和“auto”。
“l-bfgs”表示有限存储器BFGS,其是有限存储器的准牛顿优化方法。
“normal”表示使用正态方程作为线性回归问题的解析解。 此求解器仅限于“LinearRegression.MAX_FEATURES_FOR_NORMAL_SOLVER”。
“auto”(默认)表示自动选择求解器算法。 正常方程式求解器将在可能的情况下使用,但在需要时会自动回退到迭代优化方法。
@Since(“1.6.0”) -
建议树的聚集的深度-AggregationDepth:(Int)建议树的聚集(大于或等于2)的深度。
如果功能的尺寸或分区数量较大,
这个参数可以调整到更大的尺寸。
默认值为2。
@Since(“2.1.0”)