[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60348] [octave forge] (statistics) logistic_r

From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #60348] [octave forge] (statistics) logistic_regression
Date: Wed, 10 Aug 2022 14:02:50 -0400 (EDT)

Update of bug #60348 (project octave):

                  Status:                    None => Confirmed              
                 Release:                   6.1.0 => 7.2.0                  
        Operating System:               GNU/Linux => Any                    


Follow-up Comment #5:

closed the other logistic regression reports and pointed them here. 
additional testing shows that despite what the help text, most reference
material, and part of the source show, the output seems to fit -theta + x*beta
instead of what was stated earlier. 

the theta and beta are supposed to fit the data to a sigmoid function with
linear argument. a simple example:

x = [1 2 3 4 5 6 7 8 9]';
y = [0 0 0 0 1 1 1 1 1]';

the above data should produce a sigmoid that is 0 to the left of 4 and rises
to 1 to the right of 5, with a smooth transition between. 


[theta, beta] = logistic_regression(y,x)
theta = 98.193
beta = 28.047.

(y = theta + beta*x should be a line passing through the 0-to-1 transition.
with the data transition between 4 and 5, theta and beta above obviously don't
do that.)

the sigmoid function would normally be:

p(x) = 1/(1+exp(-(theta+beta*x))

plotting the four different sign options:

xtest = -10:0.1:10;
p_p_p = 1/(1+exp(-(theta+beta*xtest)); 
p_p_n = 1/(1+exp(-(theta+beta*xtest)); 
p_n_p = 1/(1+exp(-(theta+beta*xtest)); 
p_n_n = 1/(1+exp(-(theta+beta*xtest)); 


plotting that you see that only the p_n_p function actually matches the
expected sigmoid behavior.  So the output from octaves function is producing a
constants for a p(x) = 1/(1+exp(-(-theta+beta*x)) model.

I've determined we should just ignore that gamma block at the end, as it's
irrelevant to the code. the subfunction really does look like it should follow
+theta + beta*x, so not sure yet why it doesn't.


Reply to this item at:


Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]