Using trainbr in R2022b for a feedforwardnet should return the network with the best regularization. However, it seems that the best network by performance is returned. The performance in the following example is lowest in epoch 2 (as indicated by tr.best_epoch) and the returned net seem to be from this epoch (when I set net.trainParam.epochs=2 the same net results). This network is not very much regularized and the optimization process continues for another 998 epochs and ends with a "Effective # of Parameters" of roughly 4 which the result returned does not reflect at all.
If I set net.trainParam.max_fail=5; I can get train to return the net from epoch 19 which is nuch more regularized.
Long story short, I think trainbr is buggy and returns the wrong net.
[X, T_] = simplefit_dataset;
net= feedforwardnet(30, 'trainbr');
[net, tr] = train(net, X, T);
plot(X, T_, 'DisplayName', 'real')
plot(X, Y, 'DisplayName', 'model')
plot(X(tr.trainInd), T(tr.trainInd), '.', 'DisplayName', 'Training')
plot(X(tr.valInd), T(tr.valInd), 'o', 'DisplayName', 'Validation')
plot(X(tr.testInd), T(tr.testInd), '*', 'DisplayName', 'Test')