Cross Validation Loop - How to take flow variables outside the loop

Hi KNIME community,

I was checking out the various ML nodes and I wanted to see what differences changing the different parameters of the learner and partitioner node makes to the result. I made a workflow in which these parameters are defined, taken from the learner node as flow variables, and combined with the results from the predictor node. I can then read these to an Excel or CSV and then compare the results with different configs with less manual correction.

This worked fine when I was using a simple Partitioner node. But then I wanted to try it with cross-validation, and this approach would not work with the X-Partitioner X-Aggregator loop as I am taking the flow variables outside the loop. I assume I have to nest this loop with another loop (Generic Loop Start - Loop Variable nodes, maybe), but I am unable to figure out how to set this up.

So very basically, I want to take the parameters from the leaner and partitioner nodes outside the Cross Validation loop. Is it possible? Or is there a better approach to capture these parameters? I am attaching the workflow here.

Thanks!

Cross Validation Loop.knwf (1.2 MB)

Hi @aravind98 and welcome to the KNIME Community Forum :slight_smile:

My idea would be to move the part of the workflow that writes the variables to a table into the loop body, e.g. like that:

Cheers
Kathrin

Adjusted Workflow:
Cross Validation Loop.knwf (1.3 MB)

3 Likes

Hi @aravind98 & welcome to the KNIME forum community

Complementary to @Kathrin solution, please find here below a workflow which combines a -X-Partitioner- loop node with a -Loop End- node to differently gather any information generated during the cross-validation:

Moreover, it is possible too to save the intermediate models (one per iteration) as shown here in the workflow below:

Hope it helps.

Best
Ael

4 Likes

@Kathrin @aworker Thank you for your help! This will work for me.

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