Multiscale theory of synapse function with model reduction by machine learning