MATLAB: Flatten and unflatten a neural network

constrained optimizationneural networkoptimization

I've been working on optimizing a neural network. I cannot use the built in routines per se since the the ANN is embedded in a constrained optimization. It would be nice to have a pair of functions to take the ANN parameters (weights, biases) and flatten it into a vector, then to take a vector and unflatten it into a NN. I've done this manually myself for an ANN with 1 hidden layer. But I want to explore a deeper NN, and it'd be nice to have this function pair.

Best Answer

help getwb
doc getwb
help setwb
doc setwb
Hope this helps.
Thank you for formally accepting my answer
Greg