[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #58651] [octave-forge](statistics) logistic_re
From: |
Muhali |
Subject: |
[Octave-bug-tracker] [bug #58651] [octave-forge](statistics) logistic_regression: what is actually done with >2 categories? |
Date: |
Fri, 26 Jun 2020 11:56:21 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0 |
Follow-up Comment #1, bug #58651 (project octave):
I now have the impression that it must actually read
logit (gamma_i (x)) = -theta_i + beta' * x
This is demonstrated by the following code:
n = 3 ;
x = linspace(0, 5, 2*n)' ;
y = [zeros(n,1) ; ones(n,1)] ;
[theta, beta] = logistic_regression (y, x) ;
flog = @(z) 1 ./ (1 + exp(-z)) ; # the logistic function
flin = @(theta, beta, x) -theta + beta * x ; # the linear part of the
predictor
clf ;
yh = flog(flin(theta, beta, x)) ;
plot(x, [y yh], "x")
## to actually see the logistic function
hold on
n = 50 ;
x_d = linspace(0, 5, n)' ;
yh_d = flog(flin(theta, beta, x_d)) ;
plot(x_d, yh_d)
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58651>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/