Learning algorithms for oscillatory networks with gap junctions and membrane currents