Use K Nearest Neighbour to impute missing values

Any tips on how to use KNN to impute missing values? I am migrating from RapidMiner, and RapidMiner has such an operator. Knime’s Missing Values node does not provide this option.

Thanks in advance!

Hi,
Glad to hear you make the switch :smiley: You can use the Row Splitter to separate rows with missing values from the others. Then use the k-nearest Neighbors node on the data without missing values as training data and the table with missing values to predict tor. If you first remove the column with the missing values, you can configure the predictor to output a column of the same name. Using Column Resorter you can bring your columns in the correct order and using the Concatenate node you can merge it back with the table part that has no missing values. This approach only works well if the missing values are in a single column. If you have more columns to be treated, you need a Column List Loop. Let me know if that is the case!
Kind regards
Alexander

6 Likes

Can you please let us know the solution if there are missing values in multiple columns?

Hi,
Please find my solution attached.
Kind regards,
Alexander

KNN for Missing Values.knwf (35.3 KB)

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.