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

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

[Octave-bug-tracker] [bug #56118] (optim) logistic_regression gives inco


From: Muhali
Subject: [Octave-bug-tracker] [bug #56118] (optim) logistic_regression gives incorrect result
Date: Thu, 11 Apr 2019 11:08:23 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0

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

                 Summary: (optim) logistic_regression gives incorrect result
                 Project: GNU Octave
            Submitted by: muhali
            Submitted on: Thu 11 Apr 2019 08:08:21 AM PDT
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 5.1.0
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Applying a logistic regression in the following way


pkg load optim
x = (1:20)' ; y = [zeros(10, 1) ; ones(10,1)] ;
Pfun = @(p) exp(p(1) - p(2) * x) ./ (1 + exp(p(1) - p(2) * x)) ; Pin = [0 0]'
;

p1 = nonlin_curvefit (Pfun, Pin, x, y) ;
[p2(1) p2(2)] = logistic_regression(y, x) ;

subplot(2,1,1) ;
plot(x, y, "x", x, Pfun(p1), "-") ;
set(gca, "box", "off")
subplot(2,1,2) ;
plot(x, y, "x", x, Pfun(p2), "-") ;
set(gca, "box", "off")


one sees that the result cannot be correct. The reason is a mismatch between
the function description in the help text and what is actually programmed.

Using Pfun(-p2) gives the correct result.





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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