Decision Tree

I’ve just had a look at the example Decision Tree, for the red/white wine dataset.
But where do you go from there…
How do I now feed some records, without the outcome label unknown to this model, to let it decide
that my data is either red or white wine… ?


You can use the Decision Tree Learner for that. Check out for example Decision Tree – KNIME Community Hub.

I hope this helps!


1 Like

Thank you, but I’m still none the wiser…

When comparing the “Color Manager DT” and the “Red/White Wine DT”, I see that the Color Manager has 2 more nodes.

One is the Color Manager, and one is the Color Appender.

I imagine that the Color Manager is just specifically for the type of DT that is done here.
It’s an extra node, that does not apply to the context of the Red/White Winde DT.
IF I understand correctly, it visualises the data in knime://knime.workflow/data/shuttle.table
And if that understanding is correct, I’m still with you there…

But then there’s the ‘Color Appender’ …
That sounded to me as 'inject some data of which you DON’T Know the color, and let your model decide what it is…
But that doesn’t seem to be the case : If I click ‘Table with Color’ on the ‘Color Appender’,
I just see the same kind of table as with the ‘Color Manager’ …

I would expect to find a file somewhere, with the same structure as this shuttle.table,
but then WITHOUT the classification, inject it in the model, and see what the prediction is …

So I’m still trying to see some input, with, for example, a single record, and no color, dragged through
the flow, and then finally receive the predicted value …

Going back to the “Red/White Wine DT”, there I still miss the same thing.
There’s the fixed dataset, that comes with the Knime installation.
The dataset gets fed into this flow, that learns to categorise it.
Fine, I get that…
Now i want to create a new table, knime://knime.workflow/data/wine_test.table for instance,
with a few lines in there, some values for the chemical composition, WITHOUT the label Red/White
feed it to the model, and see that the Model attributes the label to it…

The funny thing is that there is a youtube video with an explanation of such a DT flow.

A certain JP there asks the question
“may I ask how to predict data after classification.I need to predict data in testing set”
So I’m not the only one with this question :wink:

Hope you can clarify…


1 Like

Ok, let’s get you started!

Right, you can basically ignore the Color Manager and Color Appender nodes in this example. They are just meant to make the visualization of the resulting decision tree beautiful.

There are several options to use the trained model on new data:

  1. Same workflow: You can read in data in the same workflow you trained the model and then simply use the Decision Tree Predictor node. The upper input of this node takes the model trained in the Decision Tree Learner and lower input port takes the new data. The output will be the classified data.

  2. Obviously, the first option is not something you want to do in production. You rather want to do the prediction in a second workflow, which can run independent of the first workflow. So what you can do is, to export the model trained in the Decision Tree Learner with the Model Writer node. In the new workflow, you can then read in the data, and the model (using the Model Reader). Rest works as with option 1.

Does this help more? Btw, in the example workflow I posted, the model is actually evaluated on “unseen data”. The input data is split using the Partitioning node. The first partition of the split dataset is used for learnering, the second partition for validation.

Hope this helps,



Believe it or not, a colleague with a background in datascience just walked by…
He showed me how to do, and it corresponds exactly with what you say…
It’s simple, once you’ve seen it :smiley:
Thx !


Fantastic. Say thanks from my side and let me know if we can help any further.




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