我知道这个问题之前已经在这里被问过。但我找不到正确的答案。上一篇文章中提供的答案表明,它的使用Statistics.chiSqTest(data)提供了拟合优度检验(皮尔逊卡方检验),而不是系数显着性的沃尔德卡方检验。
我试图在 Spark 中构建逻辑回归的参数估计表。我能够获取系数和截距,但找不到 Spark API 来获取系数的标准误差。我看到线性模型中提供了系数标准误差作为模型摘要的一部分。但逻辑回归模型摘要并没有提供这一点。部分示例代码如下。
import org.apache.spark.ml.classification.{BinaryLogisticRegressionSummary, LogisticRegression}
val lr = new LogisticRegression()
.setMaxIter(10)
.setRegParam(0.3)
.setElasticNetParam(0.8)
// Fit the model
val lrModel = lr.fit(training) // Assuming training is my training dataset
val trainingSummary = lrModel.summary
val binarySummary = trainingSummary.asInstanceOf[BinaryLogisticRegressionSummary] // provides the summary information of the fitted model
Run Code Online (Sandbox Code Playgroud)
有没有办法计算系数的标准误差。(或者获取系数的方差-协方差矩阵,从中我们可以得到标准误差)
standard-error logistic-regression apache-spark coefficients apache-spark-mllib