Differentiating and Integrating ZX Diagrams with Applications to Quantum Machine Learning