Optimal control of molecular states in a learning loop with a parameterization in frequency and time domain