patchGNU Octave - Patches: patch #10042, [octave forge] (statistics) Some...


patch #10042: [octave forge] (statistics) Some tweak to function kmeans

Submitted by:  None
Submitted on:  Wed 10 Mar 2021 07:20:53 PM UTC
Category:  None Priority:  5 - Normal
Status:  Need Info Privacy:  Public
Assigned to:  None Originator Email:  -email is unavailable-
Open/Closed:  Open
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


( Jump to the original submission )

Mon 29 Nov 2021 08:47:58 PM UTC, comment #7: 
Nir Krakauer <nir_krakauer>
Fri 26 Nov 2021 11:45:54 PM UTC, comment #6: 

AFAIU patch #8959 was about speeding up kmeans while this here is mostly about ergonomics.  So IMO this could be applied (after some testing).

Philip Nienhuis <philipnienhuis>
Project Member
Thu 25 Nov 2021 07:36:34 PM UTC, comment #5: 

The last revision of this patch file #51065 adds to current kmeans, which was last updated in 2019, the improvements listed in the original post and in comment #3, that is:

  • a "display" option, which prints a little summary
  • stop condition when no data point switches group, as the algorithm requires, practically avoiding to compute an unnecessary extra iteration
  • a warning message if the algorithm did not converge
  • a new default value for option "EmptyAction", as in MATLAB

Let me know if the patch is OK as it is, or if it needs some additional work.

Tue 23 Nov 2021 08:48:31 PM UTC, comment #4: 

unclear from comments what the current status of this patch is relative to the current state of kmeans (which includes the changes from bug #43959 which were done after the version in patch #8959. a comment on the patch is requesting similar info).

Nicholas Jankowski <nrjank>
Project Member
Sun 14 Mar 2021 10:14:51 PM UTC, comment #3: 

I tested "kmeans" with a sample of 30000 points in three clusters and it took less than half a second to do it. I think that it improved since 2016.
Anyway, I uploaded a new patch to reflect the fact that the default "EmptyAction" value for "kmeans" now is "singleton".

(file #51065)

Sat 13 Mar 2021 06:01:26 PM UTC, comment #2: 

Reading the referenced bug/patch reports I think there's a fair point about integrating the other improvements.

Philip Nienhuis <philipnienhuis>
Project Member
Thu 11 Mar 2021 06:24:30 PM UTC, comment #1: 

FYI: in patch #8959 Michael gives a more efficient method for kmeans.

I understand your patch is a small update.

The maintainers will be updating this function.

It is worth a quick review of the other patch before this one is closed?

Wed 10 Mar 2021 07:20:53 PM UTC, original submission:  

This is a small update of function 'kmeans'.

It adds the 'display' option, to show a summary of the clustering process.

It stops the iteration when no data point switches group, otherwise it takes one more iteration to meet the stop conditions, even if nothing changes.

It throws a warning when the process did not converge, e.g. when the iteration stops for reaching the maximum number of iterations and the error is still sizeable.

Note: I also posted a patch for patch #9743 silhouette function.



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

Attach Files:

Attached Files
file #51065:  kmeans.diff added by None (5KiB - text/x-patch - emptyaction: singleton)
file #51038:  kmeans.diff added by None (4KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by nir_krakauer (Posted a comment)
  • -email is unavailable- added by nrjank (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.





    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-11-23 nrjank StatusNone => Need Info
    2021-03-14 None Attached File- => Added kmeans.diff, #51065
    2021-03-10 None Attached File- => Added kmeans.diff, #51038

    Back to the top

    Powered by Savane 3.9