Weak Differentiation and Gradient Estimation for Discrete Event Driven Processes