如何使用sklearn在Logistic回归模型中查找beta值 [英] How to find beta values in Logistic Regression model with sklearn
问题描述
基于Logistic回归函数:
Based on the Logistic Regression function:
我正在尝试从 scikit-learn 中的模型中提取以下值.
I'm trying to extract the following values from my model in scikit-learn.
和
其中是截距,而是回归系数. (根据维基百科)
Where is the intercept and is the regression coefficient. (as per the wikipedia)
现在,我认为我可以通过执行model.intercept_
来获取,但我一直在努力获取.有什么想法吗?
Now, I think I can get by doing model.intercept_
but I've been struggling to get . Any ideas?
推荐答案
您可以使用model.coef_
访问特征的系数.
You can access the coefficient of the features using model.coef_
.
它给出了与值beta1
,beta2
等对应的值列表.列表的大小取决于您的逻辑回归使用的解释变量的数量.
It gives a list of values that corresponds to the values beta1
, beta2
and so on. The size of the list depends on the amount of explanatory variables your logistic regression uses.
这篇关于如何使用sklearn在Logistic回归模型中查找beta值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!