ANN in Knime

Hi everyone,

I´m using Knime to build the model of ANN, I do not know how to set the options at RProp MLP Learner. How to choose the number of hidden layers and number of hidden neurons per layer?

Thank you

Hi @Nandisha,

Welcome to the Knime community!

There is no golden rule for those numbers you are looking for working for all the possible prediction challenges. Image classification is a different beast compared to e.g. weather forecasts.
As you can see e.g. via Tensorflow model datasets there is a large number of models, all using different numbers of layers and neurons in those layers. These are models ready to use (so the learning of those models is already done on standard training sets).

So the practical solution is: you should just try different things. Search on the internet for examples where a model is created for similar problems as yours. Apply what you find on your data set and make changes to it. It might improve the accuracy, or make it worse. It will not be a first-time-right exercise, it’s hard work :wink:

1 Like

Hi JanDuo,

Thank you for your help.

I have one more question.How can we do sensitivity analysis in knime?

Hi @Nandisha

Found a similar question in this topic on the forum.
If you are looking for parameter optimization, this might be what you are looking for.

1 Like

Hallo @JanDuo,
Actually its mainly about selecting the appropriate parameters for the prediction.I do not want to optimize the output column.Is it same?

Thank you & kind regards

Hi @Nandisha,
You mentioned earlier the RProp MLP Learner which you wanted to use. Are you looking for the best values of the parameters in the configuration of this learner node?
If so, parameter optimization can be used in a search for the most optimal combination (giving e.g. the hiighest accuracy, but any other metrics you choose can be used too).
Check the description of the following node for more background on this Parameter Optimization Loop End

On the hub there are several examples with parameter optimization

If this is about some other learner node you should share some more details on the workflow/nodes you are using and what you are trying to achieve with them.

Dear JanDuo,

Many thanks for the information.Can you please explain to me how I should configure the parameter optimization loop given that I have 10 variables?I have confusion regarding the configuration.

Thank you & kind regards,
Nandisha

Hi @Nandisha,
Which learner node are you using?

Hi @JanDuo

I am using the parameter optimization loop start and loop end.

Thank you

Hi @Nandisha

I’m still not certain which learner node you are using (the more details you share, the better answer you can get), but to give you an idea how the parameter optimization works I made the following workflow for you.

You can play it yourself with: 27490.knwf (40.7 KB)

It contains fabricated (meaningless) testdata, which was necessary to make this example workflow.

1 Like

Hi @JanDuo,

Thank you for your support.Actually this is almost exactly the workflow I did.Just I have an excel reader instead of a table creator.I just want to know how I should configure the parameter optimization loop start and the parameter optimization loop end.I have around 9 variables.Should I input it one by one in the parameter Optimization Loop start?

Thank you.

Hi @Nandisha

Great, so you almost cracked this problem yourself :slight_smile:

You can add for each parameter in the configuration of the learner a parameter in the parameter optimization. Check the flow variables tab of the RProp MLP Leaner in the example how to link them.

If your leaner has 9 parameters to configure, you can add all nine (or less), whatever you want.

1 Like

Hi @JanDuo,

Thank you for your help.I would also like to ask you if I am using like 10 variables to predict,how will I know which of the variables are used in the prediction and which one are not useful.I want to get the class column and the predicted data same.

Thank you once again.

Hi @Nandisha,

Neural networks are black box models. You give it some input and it creates an output ‘magically’. It does it well, which you can proof through the tests you have done and the optimized accuracy (if you take that as a measure). You don’t have insight which variable is important and which isn’t.

If you want to get this insight on which variable is important you might want to look at the node Feature Selection Loop Start (1:1) and how that’s used.
Search on the https://hub.knime.com for examples on feature selection.
But, as with the parameter optimization, this means looping through many model-creations and testing cycles to determine which variable (or feature) is important and which one not.

If you want to get a feeling on the important features use a Decision Tree Learner and look at the determined model. The most important features are used in the decisions in the top of the tree. Features found only in lower branches or leaves are less important.
BUT: you’ll never know if your ANN will have the same sequence from important to superfluous as your decision tree model is giving.

So it’s a good approach to use several different types of leaners and compare their respective results. If you have a simple model, which you can explain how it works, which performs almost the same as a very complex one, which is a black box model and cannot be explained by you, what model would you prefer? [just think about this, I’m not really lookinng for the answer :wink: ]

2 Likes

Hi @JanDuo,

Thank you so much for your support.I would like to ask you how can I get the predicted results same as the class column?Is there a way I can get it same to same using ANN or any other model?

Thank you.

Maybe I’m not understanding your question correctly.

If you look at the output of the predictor node you will see the class and its prediction.

From the workflow added earlier:
afbeelding

Whatever learner node you use, the associated predictor node will add such a prediction column.

I meant to say that the output column and the prediction to be same.How can I model it so that they are same that is without any error.

Thank you.

Hi @Nandisha,

Only in a perfect world this would be possible.

Hi @JanDuo,

Thank you for your reply.I would like to ask you how to do the feature selection node that is the workflow?
Or can you please send me a link.

Thank you.

1 Like