लॉजिस्टिक रिग्रेशन को बंद रूप में हल कब किया जाता है?


31

लो x{0,1}d और y{0,1} और लगता है हम रसद प्रतिगमन का उपयोग कर भविष्यवाणी y दिया एक्स का कार्य मॉडल। लॉजिस्टिक रिग्रेशन गुणांक को बंद रूप में कब लिखा जा सकता है?

एक उदाहरण है जब हम एक संतृप्त मॉडल का उपयोग करते हैं।

है यही कारण है, को परिभाषित P(y|x)exp(iwifi(xi)) है, जहां i की शक्ति-सेट में अनुक्रमित सेट {x1,,xd} , और fi रिटर्न 1 यदि i के वें सेट में सभी चर 1, और 0 अन्यथा हैं। तो फिर तुम प्रत्येक व्यक्त कर सकते हैं wi डेटा के आंकड़ों का एक तर्कसंगत समारोह के लघुगणक के रूप में इस रसद प्रतिगमन मॉडल में।

क्या बंद फॉर्म मौजूद होने पर अन्य दिलचस्प उदाहरण हैं?


4
मुझे लगता है कि आप का मतलब है "बंद फॉर्म में मापदंडों के MLE कब हैं?"
Glen_b -Reinstate मोनिका

Can you give more detail what you did? Your question reads as if you tried to derive the ordinary least squares estimator for a logistic regression problem?
Momo

1
Thanks for the interesting post/question, Yaroslav. Do you have a reference for the example that you show?
Bitwise

1
It's been a while, but possibly it was in Lauritzen's "Graphical Models" book. The broader foundations of the answer for this question are there -- you get closed form solution when the (hyper)graph formed by sufficient statistics is chordal
Yaroslav Bulatov

This might be interesting tandfonline.com/doi/abs/10.1080/… I believe this is a special case of an analytical solution when you only have a 2x2 table
Austin

जवाबों:


33

As kjetil b halvorsen pointed out, it is, in its own way, a miracle that the linear regression admits an analytical solution. And this is so only by virtue of linearity of the problem (with respect to the parameters). In OLS, you have

i(yixiβ)2minβ,
which has the first order conditions
2i(yixiβ)xi=0
For a problem with p variables (including constant, if needed—there are some regression through the origin problems, too), this is a system with p equations and p unknowns. Most importantly, it is a linear system, so you can find a solution using the standard linear algebra theory and practice. This system will have a solution with probability 1 unless you have perfectly collinear variables.

Now, with logistic regression, things aren't that easy anymore. Writing down the log-likelihood function,

l(y;x,β)=iyilnpi+(1yi)ln(1pi),pi=(1+exp(θi))1,θi=xiβ,
and taking its derivative to find the MLE, we get
lβ=idpidθ(yipi1yi1pi)xi=i[yi11+exp(xiβ)]xi
The parameters β enter this in a very nonlinear way: for each i, there's a nonlinear function, and they are added together. There is no analytical solution (except probably in a trivial situation with two observations, or something like that), and you have to use nonlinear optimization methods to find the estimates β^.

A somewhat deeper look into the problem (taking the second derivative) reveals that this is a convex optimization problem of finding a maximum of a concave function (a glorified multivariate parabola), so either one exists, and any reasonable algorithm should be finding it rather quickly, or things blow off to infinity. The latter does happen to logistic regression when Prob[Yi=1|xiβ>c]=1 for some c, i.e., you have a perfect prediction. This is a rather unpleasant artifact: you would think that when you have a perfect prediction, the model works perfectly, but curiously enough, it is the other way round.


the question is why your last equation is not solvable. is it due to the logistic function's inverse diverging at 0 and 1, or is this due to the nonlinearity in general?
eyaler

5
(+1) Regarding your last paragraph: From a mathematical perspective it does work "perfectly" in the sense that an MLE will yield a perfect separating hyperplane. Whether your numerical algorithm behaves sensibly in that circumstance is a separate matter. Laplace smoothing is often used in such situations.
cardinal

@eyaler, I would say this is due to nonlinearity in general. My understanding is that there is a limited set of circumstances when this can be solved, although I don't know what these circumstances are.
StasK

1
I don't understand, what mathematical condition is present that makes the system not have a closed form solution? Is there a general condition where things in general don't have closed form solutions?
Charlie Parker

does the fact that logistic regression has no closed form something one can prove by looking at the gradient descent iteration for it?
Charlie Parker

8

This post was originally intended as a long comment rather than a complete answer to the question at hand.

From the question, it's a little unclear if the interest lies only in the binary case or, perhaps, in more general cases where they may be continuous or take on other discrete values.

One example that doesn't quite answer the question, but is related, and which I like, deals with item-preference rankings obtained via paired comparisons. The Bradley–Terry model can be expressed as a logistic regression where

logit(Pr(Yij=1))=αiαj,
and αi is an "affinity", "popularity", or "strength" parameter of item i with Yij=1 indicating item i was preferred over item j in a paired comparison.

If a full round-robin of comparisons is performed (i.e., a pairwise preference is recorded for each unordered (i,j) pair), then it turns out that the rank order of the MLEs α^i correspond to the rank order of Si=jiYij, the sum total of times each object was preferred over another.

To interpret this, imagine a full round-robin tournament in your favorite competitive sport. Then, this result says that the Bradley–Terry model ranks the players/teams according to their winning percentage. Whether this is an encouraging or disappointing result depends on your point of view, I suppose.

NB This rank-ordering result does not hold, in general, when a full round-robin is not played.


2
I was interested in binary because it was easiest to analyze. I have found a very broad sufficient condition in works of Lauritzen -- you get closed form if a corresponding log-linear model is decomposable
Yaroslav Bulatov
हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.