An algorithmic framework for the optimization of deep neural networks architectures and hyperparameters