Partitioning

Hi everyone,

First of all sorry for my english. I'm new to knime and I'm trying to split a dataset into a training and a testing set. But In my initial dataset I have many rows belonging to the same category and I want these categories stay together after the splitting, like all the rows belonging to category 1 are in the same partition.

Little example :

Before partitioning : 

Row1 -> Value : 2 -> Category 1

Row2 -> Value : 5 -> Category 1

Row3 -> Value : 6 -> Category 1

Row4 -> Value : 3 -> Category 2

Row5 -> Value : 1 -> Category 2

Row6 -> Value : 4 -> Category 3

Row7 -> Value : 3 -> Category 3

Row8 -> Value : 1 -> Category 4

Row9 -> Value : 2 -> Category 4

 

After partitioning :

Partition 1 :

Row1 -> Value : 2 -> Category 1

Row2 -> Value : 5 -> Category 1

Row3 -> Value : 6 -> Category 1

Row8 -> Value : 1 -> Category 4

Row9 -> Value : 2 -> Category 4

 

Partition 2 :

Row4 -> Value : 3 -> Category 2

Row5 -> Value : 1 -> Category 2

Row6 -> Value : 4 -> Category 3

Row7 -> Value : 3 -> Category 3

 

Have you any idea how to do that with Knime ? Thanks in advance for your answers!

I'd suggest using the Nominal Value Row Filter and then create the inverse set by using the Reference Row Filter.

Hi gabriel,

Thanks for your answer.

I managed to do that by partitioning only the category randomly, and then rejoing the dataset to the corresponding with the Join node.