Hi All having an ANN network , in I inputs and O outputs, how do we know the number of hidden nodes? is it related to the number of hidden layers ? when designing an I H O topology , when you set the Hmax and Hmin and dH , you can change the number of trials by changing any of the Hmin , Hmax or even dH what is the main rule ? and advised relation between dH and Hmin ? should they be specific numbers ?
Kshitij Singh answered .
2025-11-20
[I N ] = size(input) % size("I"nput)
[O N ] = size(target) % size("O"utput)
Ntrn = N - 2*round(0.15*N) % Default no. of training examples ~ 0.7*N
Ntrneq = Ntrn*O % No. of training equations
Nw = (I+1)*H +(H+1)*O % No. of unknown weights for H = number of hidden nodes
Hub = -1 + ceil( (Ntrneq - O) / (I+O+1) ) % integer H
net.trainPerform.goal = 0.01*mean(var(target',1)))
0 <= Hmin <= H <= Hmax <= Hub
Validation Stopping and/or regularization (e.g., msereg or TRAINBR}