MATLAB: How to specify the transfer function for the hidden and output layer

Deep Learning Toolboxfeedforwardnetneural networks

I am using feedforwardnet to create a neural network. But this function takes only two arguments: the hidden layer sizes and the training function. I want to specify the transfer functions for each layer.

Best Answer

Use fitnet for regression/curve-fitting or patternnet for classification/pattern-recognition. Both call feedforwardnet.
2 layers are sufficient: 1 hidden + 1 output
Standardize(0-mean/unit-variance via zscore or mapstd) inputs and regression outputs.
Remove or modify outliers
Convert classification targets to 0-1 unit vectors via ind2vec
Accept the fitnet default transfer functions tansig/purelin
For classification the default tansig/softmax transfers are the better choice
The best way to choose initial weights and number of hidden nodes is via trial and error.
I have posted many double for loop examples. Search the NEWSGROUP and ANSWERS
greg fitnet Ntrials % for regression
greg patternnet Ntrials % for classification
Hope this helps.
Thank you for formally accepting my answer
Greg