[scikit-learn] Bounded logistical regression in Python

Jaap van Kampen jaapvankampen at gmail.com
Thu Jan 31 04:51:36 EST 2019


Hi there!
The standard logistical regression solver
<https://github.com/scikit-learn/scikit-learn/blob/7389dba/sklearn/linear_model/logistic.py#L998>
in scikit-learn assumes the regression equation:<p>
P(X) = 1/ (1 + exp(b0 + b1*X1 + ... + bn*Xn))</p>
.. and solves for the b's using various solver routines.

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, e.g.<p>
P(X) = a / (1 + exp(b0 + b1*X1 + .. + bn*Xn) * (Xk  - c)))  </p>
... and solve for a, b's and c.

Any thoughts/ideas on how to modify logistic.py to achieve this? I thought
of modifying the expit
<https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.special.expit.html>function
to reflect the changed equation. But how do a let the solvers know to also
include the new variables a and c? Any scripts available that are able to
handle my modified logistic regression equation?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20190131/bd50b549/attachment.html>


More information about the scikit-learn mailing list