如何从 AutoML Databricks 中的逻辑回归中获取系数

How to get coefficients from a logistic regression in AutoML Databricks

提问人:alisondu77 提问时间:8/22/2023 最后编辑:bartekczrnalisondu77 更新时间:9/6/2023 访问量:28

问:

希望每个人都能享受这一天;)

这是我第一次在 Databricks 中使用 AutoML。很抱歉,如果我的问题很简单(对不起我的英语不好,我是法国人):P

我在 AutoML 中最好的模型之一是逻辑回归,我希望拥有每个变量的系数。 只有当我将“shap_enabled”设置为“True”时,我才能找到“功能重要性”。 但这对我没有帮助。 我希望能够“手动编写”我的模式。 例如,如果我的模型是:温度 = 0.12 + 2.3percent_of_CO2 + 1.2percent_of_humidity)。 我想收集,0.12,2.3(percent_of_CO2),1.2(percent_of_humidity)。

提前感谢您的帮助! 此致敬意

艾莉 森

我尝试在其他论坛上查看,但似乎没有答案。 我试图改编我用于 pysparks 决策树的代码,但它也没有成功。

Feature_importance = sorted((attr["idx"], attr["name"]) for attr in (chain(*pipdata.schema["features"].metadata["ml_attr"]["attrs"].values())))
    Final_list = [(name, idx, bestmodel.featureImportances[idx]) for idx, name in Feature_importance]
    Features_Importances = spark.createDataFrame(pd.DataFrame(Final_list, columns =['Features_names', 'Features_Index','Features_Importance'])).coalesce(1)
    display(Features_Importances)
    Features_Importances_PD = Features_Importances.toPandas()
    Features_Importances_PD['Features_Index'] = "feature "+Features_Importances_PD['Features_Index'].astype(str)
    Dictionnaire = pd.Series(Features_Importances_PD.Features_names.values,index = Features_Importances_PD.Features_Index).to_dict()
    interpretation_model = bestmodel.toDebugString
    for word, initial in Dictionnaire.items():
      interpretation_model = interpretation_model.replace(word.lower()+" ", initial)```
对 Databricks Logistic-Regression Coefficients AutoML 进行建模

评论


答: 暂无答案