bugGNU Octave - Bugs: bug #60348, [octave forge] (statistics)...

 
 

bug #60348: [octave forge] (statistics) logistic_regression

Submitted by:  Muhali <muhali>
Submitted on:  Tue 06 Apr 2021 09:14:52 AM UTC  
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  6.1.0 Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 06 Apr 2021 09:14:52 AM UTC, original submission:  

The code below shows that the logistic_regression function outputs incorrect probabilities.

pkg load statistics

urlwrite('http://archive.ics.uci.edu/ml/machine-learning-databases/spambase/spambase.data', '/tmp/spambase.data') ;
load /tmp/spambase.data

X = spambase(:,1:end-1) ;
Y = spambase(:,end) ;

[THETA, BETA, DEV, DL, D2L, P] = logistic_regression (Y, X) ;
P2 = 1 ./ (1 + exp(-(THETA - X * BETA))) ;

corr(P, Y)
corr(P2, Y)

Note that according to the docs, "P holds estimates for the conditional distribution of Y given X."

The results are corr(P,Y)=-0.12 and corr(P2,Y)=-0.88. The latter coincides with the results obtained by Matlab, using

[B DEV STATS] = mnrfit(X,Y+1) ;
P = mnrval(B,X) ;
corr(P, Y+1)

Inspecting P it turns out that, in this particular example, one has

P1(1:1813) = 1 - P2(1:1813)

but

P1(1814:end) = P2(1814:end)

This may or may not be related to similar open bugs of the same function, such as #56118 and #58651.

Muhali <muhali>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by muhali (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.6