我编写了这段代码,并且系数不作为稀疏向量提供,因此我无法提取索引来标识的有效条目 模型。
lr = LogisticRegression(elasticNetParam = 1.0, featuresCol = "features",
labelCol = target_var)
lasso_model = lr.fit(training_full)
## Extract variables with coefficients !=0 (sparse vector) + sorting
coeff = lasso_model.coefficients
coeff.indices