Looping every row (same file) for most similar location

Hello, I’m relatively new to KNIME so still trying to learn and navigate around it.

I have a data set (single file) of demographic traits for a list of 200 locations. I’d like to do a Similarity Search on every row to find its most similar location. Ultimately, populate a new column for most similar location.

Below is what I have so far. I am stuck on how to structure this as a loop. I am envisioning the upper Row Filter to select the location to run similarity search for, and the bottom Row Filter to select all other locations, to pair for similarity search → loop for the next sets of locations until the all rows have been searched.

Anyone have an example workflow?

Welcome to the forum @jcjcjc.

If you want to create a loop, then you’d need to explore at the various Loop nodes.

However, it seems to me that the Similarity Search node does exactly what you’re trying to do already. The node takes each row in the table at Port 0 and compares it to each row in the table at Port 1, and returns the number of rows matching the similarity/distance criteria you specify.

As far as I can tell, you don’t need the Row Filter nodes. Simply connect the Normalizer node to both ports of the Similarity Search node.

2 Likes

Hi @jcjcjc and welcome to the forum.

Take a look at these example workflows and see if they can help you:

3 Likes

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