Dear KNIME users,
is there a way to convert Integer values to Double values? I'm aware of a node for the "other way around" (Double to Int).
In general, is there a way to control the variable type during the input procedure? Particularly, I'm reading in SD files: here, some types are set to Double, the others are set to Integer. For me´, I don't see a consistent way how the variable types are set.
Your probably looking for the Rename node that allows converting into all compatible (without loss of precision) column types.
You can use the Math node and just return that column. The math node always gives back a double column even if you only perform integer calculations.
thanks for you help. I use the "rename" node convert the INTEGER column to a DOUBLE column.
Now I run into the following WEKA error:
WARN Weka Predictor The attribute 'XYZ' has a different type in the test data (DoubleCell vs. Non-Native [interface org.knime.core.data.DoubleValue, interface org.knime.core.data.IntValue, interface org.knime.core.data.DataValue, interface org.knime.core.data.LongValue, interface org.knime.core.data.ComplexNumberValue, interface org.knime.core.data.FuzzyNumberValue, interface org.knime.core.data.FuzzyIntervalValue, interface org.knime.core.data.BoundedValue])
The training set cpds have the "original" DOUBLE values, and I converted the test set cpds to "DOUBLE" values. Could this somehow have gone wrong?
Sorry, I somehow got lost. Are the values in this particular column doubles or ints. When you read in the data, for example with the File Reader, you can correct the guessed column type from int to double. Do you have an example on how to reproduce the behavior in the Weka Predictor. Cheers.
I also got lost... Therefore, I repeated the model building from scratch, and now everything is working fine, Murphy's law!
But thanks for your efforts!
I would also like to see an Int to Double node. The math node and the rename node is ok for few columns, but inconvienient for more.
Here is my problem 1: I use flow variables in the groupby node and if the aggregation colum changes from double to int I get problems (Invalid columns!). Turning all columns to double columns would solve that problem.
Here is my problem 2: now I use the rename node for turning int to double (sa suggested above), it works (although also inconvienient for many columns!), and the columns appear as doubles in the table and I dont have problems downstream in my workflow. However in the Spec tab the renamed/converted columns appear as type Non-native, which I generally try to avoid. What is the reason?
I think your solution would be to have the "Column rename" node equipped with a standard column select GUI like in column filter etc. This should be easy to do, and would suit the ages-old column rename node quite nicely. :-)
Or maybe I'm oversimplifying this... but anyway. Feature request seconded: Please improve this node. Also perhaps rename it to "Column Rename & Retype" to make the type function clear.
Finally, I think you might be able to do it conveniently already if a unique primary key is present (if not create one from RowID): Use GroupBy to group by the unique key, and unleash "type based aggregation" on your Ints - you will want to use the "Mean" function and "Keep column names". Should do the trick, but I admit that this is non-obvious and slightly hacky. :P
EDIT: Not sure about your problem 2 by the way, important for KNIME to look into I'd think.
Not nice but suitable for many columns:
Use Number To String and String To Number. It offers you the comfortable column selection and does the job.
As for the feature request: An Int To Double node would be something that is used only in very specific situations. I would rather suggest to remove the converter-functionality from the Rename node and move it into a node of its own with a more specialized GUI.