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

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

[Octave-bug-tracker] [bug #42122] kmeans in statistics package produces


From: anonymous
Subject: [Octave-bug-tracker] [bug #42122] kmeans in statistics package produces error when an option is set but not emptyaction
Date: Tue, 15 Apr 2014 10:09:18 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0

URL:
  <http://savannah.gnu.org/bugs/?42122>

                 Summary: kmeans in statistics package produces error when an
option is set but not emptyaction
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Tue 15 Apr 2014 10:09:17 AM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.8.1
        Operating System: GNU/Linux

    _______________________________________________________

Details:

I am using Octave 3.8 and the statistics package version 1.2.3, when I make a
call like:
kmeans(data,8,'distance','cityblock')
I get an error such as:

error: Invalid call to tolower.  Correct usage is:

 -- Mapping Function: tolower (S)
 -- Mapping Function: lower (S)

error: called from:
error:   /usr/share/octave/3.8.1/m/help/print_usage.m at line 89, column 5
error:   /home/ubuntu/octave/statistics-1.2.3/kmeans.m at line 53, column 5


The problem seems to be that the following bit of code in kmeans.m assumes
that whenever there is some parameter set, emptyaction must be set, i.e. that
"find (strcmpi (prop, "emptyaction") == 1)" finds something, however when
'emptyaction' is not set this line produces an empty result:

if (length (varargin) > 0)
    ## check for the 'emptyaction' property
    found = find (strcmpi (prop, "emptyaction") == 1);
    switch (tolower (prop{found+1}))
      case "singleton"
        emptyaction = "singleton";
      otherwise
        error ("kmeans: unsupported empty cluster action parameter");
    endswitch
  endif


changing it to the following solved the problem for me:

  if (length (varargin) > 0)
    ## check for the 'emptyaction' property
    found = find (strcmpi (prop, "emptyaction") == 1);
    if (~isempty(found))
      switch (tolower (prop{found+1}))
        case "singleton"
          emptyaction = "singleton";
        otherwise
          error ("kmeans: unsupported empty cluster action parameter");
      endswitch
    endif
  endif


Thanks,
Anton




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?42122>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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