Number of nodes per layer in fluid.mlpregressor~?

Hey!

Just wondering if it is possible to set the number of nodes in a layer for fluid.mlpregressor~? The docs mention that it defaults to 2 layers and 3 nodes/layer. It’s clear that one can set the number of layers with @hidden, but how to set the nodes?

Thanks,
B

@hidden takes a list, so you input however many layers you want, and the number per entry in the list is the amount of nodes per layer.

Ah I see! Thanks!!

the in and out are set by your input and output size, but yes, hidden is a list of your hidden layers structures. they share the same activation, except the output one which has its own attribute

I see. So if I have @hidden 3 64 will I get 3 hidden layers with 64 nodes each?

Nope. Syntax is a bit confusing…

If you want three hidden layers with 64 nodes each it would be @hidden 64 64 64. In other places the general syntax is [number] -> [modifier] (e.g. @addrange 2 4 = start at column 2 and add 4 columns after that), but here it’s completely separate numbers denoting the amount of nodes per layer.

As an aside, I’m guessing this is another scikit syntax import, but something like @structure or @hiddenlayers or something like that may make more sense in terms of legibility as the singular of @hidden makes it unclear that it takes a list (like @fftsettingSSS), and also makes it seem like it’s referring to something else, like a binary flag or something.

1 Like

OK! Yes, +1 for naming it @hiddenlayers to suggest it is a list. It is also very good that you can set the sizes per layer! In tensorflow/keras I usually see that the first hidden layer is the biggest, and then it feeds forward to gradually smaller layers something like @hidden 128 64 32 (or maybe 64 64 32 16, depends on the speed and the complexity/nature of the task…).

1 Like