octave-bug-tracker
[Top][All Lists]
Advanced

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

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


From: Muhali
Subject: [Octave-bug-tracker] [bug #60348] [octave forge] (statistics) logistic_regression
Date: Tue, 6 Apr 2021 05:14:53 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0

URL:
  <https://savannah.gnu.org/bugs/?60348>

                 Summary: [octave forge] (statistics) logistic_regression
                 Project: GNU Octave
            Submitted by: muhali
            Submitted on: Tue 06 Apr 2021 02:14:52 AM PDT
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 6.1.0
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

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.




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60348>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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