Separation of time scales and direct computation of weights in deep neural networks