k-means throws Runtime error with integer inputs.

k-Means in the Node repository states that it accepts "all numerical values" as inputs. 

Input Ports
0 Input to clustering. All numerical values and only these are considered for clustering. 

However, integers cause errors. This was problematic for me because using "Category to Number" to convert strings creates integers. This is the error message:

ERROR k-Means              3:1        Execute failed: Runtime class of object "1.0" (index 0) in row "Cluster0" is Number (double precision) and does not comply with its supposed superclass Number (integer)

It was not easy to understand this runtime error. The way I solved this problem was to convert all integers to doubles using a Round Double node. Luckily the Round Double node doesn't throw the same error as k-Means, despite claiming a stricter input of "double values" than "all numerical values". My suggestion to fix this error in k-Means is to convert integers to doubles, or don't accept integers as inputs and state clearly in the error message that users cannot use integer valued inputs for k-means.

Here is a quick screenshot to demonstrate. I used the Table Creator node to create a tiny table with integer valued data. I then piped the table into the k-Means node, which accepted all the integer columns as I expected. However, when the k-Means node was executed, the runtime error was thrown.

Screenshot may not be appearing properly so here is the link: http://imgur.com/4WMtf7n

Hi Tom,

this bug was fixed for 3.1.1 which was released recently. See here https://tech.knime.org/changelog-v310 Bug 6625)

Could you update KNIME Analytics Platform to this version?

Best, Iris

Ok, I got the new version 3.1.1 and it all seems to work as described. Any Number value (double, integer or long) is accepted, but not non-numeric values (bit vector, boolean, byte vector, JSON, String, URI).

To convert non-numeric values: For bit/byte vector, use an "Expand Bit/Byte Vector" node to create an integer. For String, use a String To Number node.