简体   繁体   English

Python中的有限逻辑回归

[英]Bounded logistic regression in Python

The standard logistic regression solver in scikit-learn assumes the regression equation: scikit-learn中的标准逻辑回归求解器假定回归方程:

P(X) = 1/ (1 + exp(b0 + b1*X1 + ... + bn*Xn))

.. and solves for the b 's using various solver routines. ..并使用各种求解器例程求解b

For a specific project, I'd like to bound the regression equation between 0-a (instead of 0-1) and add a variable c to center an independent variable Xk , eg 对于特定项目,我想将回归方程限制在0-a (而不是0-1)之间,并添加变量c来使独立变量Xk居中,例如

P(X) = a / (1 + exp((b0 + b1*X1 + .. + bn*Xn) * (Xk  - c)))

and solve for a , b 's and c . 并求解abc

Any thoughts/ideas on how to modify logistic.py to achieve this? 关于如何修改logistic.py以实现此目标的任何想法/想法? I thought of modifying the expit function to reflect the changed equation. 我考虑过修改expit函数以反映更改后的方程式。 But how do a let the solvers know to also include the new variables a and c ? 但是,如何让求解器知道还包括新变量ac呢? Any scripts available that are able to handle my modified logistic regression equation? 有没有可用的脚本能够处理我修改后的逻辑回归方程式?

It is not totaaly clear what you need but 尚不清楚您需要什么,但

P(X) = a / (1 + exp(b0 + b1*X1 + .. + bn*Xn) * (Xk  - c))

that's the same as 那和

P(X) = a / (1 + exp(b0 + b1*X1 + .. + bn*Xn + log(Xk)/log(c))

so replace c by exp(1/bk) 所以用exp(1/bk)替换c

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM