Hello
We have an input table that each row is a list of sets
We want to put run this python code- but how we can read it as a list of sets?
import knime.scripting.io as knio
This example script simply outputs the node’s input table.
sets = knio.input_tables[0][‘sets’]
k = len(sets)
distances =
for s1, s2 in combinations(sets, 2):
intersection = s1.intersection(s2)
union = s1.union(s2)
jaccard_distance = 1 - len(intersection) / len(union)
distances.append(jaccard_distance)
diversity = sum(distances) / len(distances)